How do I automatically run an .m file?

조회 수: 8 (최근 30일)
Caroline McDonald
Caroline McDonald 2018년 10월 23일
답변: Image Analyst 2018년 10월 24일
I have written an .m file that outputs two graphs. I need to run it numerous times to validate it. Is there a way to automate running it while checking for the success criterion?

답변 (2개)

YT
YT 2018년 10월 23일
Make a function out of it...
%%GraphFunction.m
[outputarguments] = function GraphFunction(inputarguments) %leave empty if no input/output arguments
%do some stuff
end
... create another file and call your graph function in a loop...
%%%Main.m
a = 100; %amount of times you want to run the GraphFunction
for i = 1:a
outp = GraphFunction();
%check if your output was ok
end

Image Analyst
Image Analyst 2018년 10월 24일
You can automatically run it when you launch MATLAB by calling the script or function from within your startup.m file.

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by