Subroutine functions in MatLab

조회 수: 25 (최근 30일)
Mohamed Agha
Mohamed Agha 2018년 8월 9일
댓글: Walter Roberson 2023년 1월 20일
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( )"?

답변 (1개)

James Tursa
James Tursa 2018년 8월 9일
편집: James Tursa 2018년 8월 9일
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
Rajasmita Sahoo
Rajasmita Sahoo 2023년 1월 20일
did that method work in your case @Mohamed Agha , whatever told by @James Tursa ?
please kindly reply.
Walter Roberson
Walter Roberson 2023년 1월 20일

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Performance and Memory에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by