How to call one program from another in MATLAB?

5 visualizaciones (últimos 30 días)
Aishwarya
Aishwarya el 3 de Abr. de 2011
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.

Respuesta aceptada

Matt Fig
Matt Fig el 3 de Abr. de 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
  2 comentarios
Aishwarya
Aishwarya el 3 de Abr. de 2011
Thank You !
Matt Fig
Matt Fig el 3 de Abr. de 2011
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by