How can I divert my program on a new program and return it?

조회 수: 1 (최근 30일)
Ayob
Ayob 2013년 6월 2일
I wrote a program which I named it "file1.m".After calculating some arrays and matrices, my program should go on the other program which I called it "file2.m" and after calculating some new matrices which are based on some matrices evaluated on "file1.m" before diverting to "file2.m" it should return to the same line of "file1.m" that it was ordered to go on "file2.m" and do other orders by using matrices evaluated in "file1.m" before going to "file2.m" and matrices calculated in "file2.m".
I don't know how can order my program "file1.m" to go on "file2.m" at a specific "file1.m" line and how to return it after finishing "file2.m" .
As I calculate some matrices and arrays in each of "file1.m" and "file2.m" with the help of matrices and arrays evaluated on the other file, I'm a doubtful whether this kind of writing and diverting bring about any problem like losing data or other similar problems.

답변 (1개)

Image Analyst
Image Analyst 2013년 6월 2일
I don't know if you want to run those m-files and get values back that you want to save in your main program, or just run them. If you want to get something back, you'll have to have this (or similar) in a loop over all the m-files you want to run:
[out1, out2] = file1(in1, in2, in3);
Then do something with out1 and out2. Do the same for all other files you want to run.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by