How to call one program from another in MATLAB?
5 views (last 30 days)
Show older comments
I have to call a program/ module from another. If possible please give an example. Say, there's a program which sends integers from 1 to 10 to another program, and the other program adds 2 to each integer that it gets and prints it.
0 Comments
Accepted Answer
Matt Fig
on 3 Apr 2011
Save this first function in one M-file (copy and paste it, then save it):
function [] = receives_integers()
% Prints integers it gets.
INT = sends_integers; % Call the other function.
for ii = 1:length(INT)
disp(INT(ii)+2)
end
And then save this next function to another, separate M-file:
function INT = sends_integers()
% Sends 1 through 10.
INT = 1:10;
Now from the command line, type this and hit return:
receives_integers
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!