Subroutine functions in MatLab

25 visualizaciones (últimos 30 días)
Mohamed Agha
Mohamed Agha el 9 de Ag. de 2018
Comentada: Walter Roberson el 20 de En. de 2023
How can I make a subroutine module (similar to another programming languages) in a MatLab m-file program?
How to call it in case you no variables between the function brackets such as "function [ init ] = init( )"?

Respuestas (1)

James Tursa
James Tursa el 9 de Ag. de 2018
Editada: James Tursa el 9 de Ag. de 2018
Create a file with the following name: init.m
Put your code into this file, e.g.,
function stuff = init
stuff = whatever;
end
Call this function like you would any other function:
mystuff = init;
  12 comentarios
Rajasmita Sahoo
Rajasmita Sahoo el 20 de En. de 2023
did that method work in your case @Mohamed Agha , whatever told by @James Tursa ?
please kindly reply.
Walter Roberson
Walter Roberson el 20 de En. de 2023

Iniciar sesión para comentar.

Categorías

Más información sobre Performance and Memory en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by