linking m-files togeher

Is it possible to link 2 seperate m-files where both m-files has their own function with different saved name?

1 comentario

per isakson
per isakson el 10 de Jun. de 2015
What exactly do you mean by "link 2 seperate m-files" ?

Iniciar sesión para comentar.

Respuestas (1)

dpb
dpb el 10 de Jun. de 2015

0 votos

You don't actually "link" m-files together, you create a script (or another function) that calls the two successively. Or, if they're always used together but it's handy for factorization to have them as two functions, the one which is called by the other can become a subfunction within the same file. In this case that second function is not visible outside the file, however, only accessible to the primary function in the file. This may (or may not) be the behavior desired; all depends on your needs.

4 comentarios

Steven Chong
Steven Chong el 10 de Jun. de 2015
I created two m - files with different different function. Then I create the 3rd m - file, how can generate a code so that the 1st and 2nd files can be run in the 3rd file using if else statement?
Walter Roberson
Walter Roberson el 10 de Jun. de 2015
if rand() > 0.5
name_of_first_file;
else
name_of_second_file;
end
Steven Chong
Steven Chong el 10 de Jun. de 2015
If I conditions were using 1 or 2 should be the same?
Walter Roberson
Walter Roberson el 10 de Jun. de 2015
if value_to_test == 1
name_of_first_file;
else
name_of_second_file;
end

Iniciar sesión para comentar.

Categorías

Más información sobre Files and Folders en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 10 de Jun. de 2015

Comentada:

el 10 de Jun. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by