Subroutine functions in MatLab

30 Ansichten (letzte 30 Tage)
Mohamed Agha
Mohamed Agha am 9 Aug. 2018
Kommentiert: Walter Roberson am 20 Jan. 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( )"?

Antworten (1)

James Tursa
James Tursa am 9 Aug. 2018
Bearbeitet: James Tursa am 9 Aug. 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 Kommentare
Rajasmita Sahoo
Rajasmita Sahoo am 20 Jan. 2023
did that method work in your case @Mohamed Agha , whatever told by @James Tursa ?
please kindly reply.
Walter Roberson
Walter Roberson am 20 Jan. 2023

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Performance and Memory finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by