How to define a function to run a particular .m file
Mostrar comentarios más antiguos
Hi,
Probably a simple question but I can't figure it out.
I'm trying to write a kind of shell program which gives users the option to run 26 different codes.
For example, I want to define the function "indcomuse" to run the .m file "a2x1combined.m"
How would I go about doing that? Thanks!
1 comentario
Mason
el 24 de Oct. de 2013
Respuestas (2)
Wayne King
el 24 de Oct. de 2013
You can simply call a defined function inside of another function. As long as both are on the MATLAB path.
If the user passes a function name as a string, or function handle, you can use feval() to run that function
For example:
S = 'mean';
x = randn(10,1);
feval(S,x)
1 comentario
Mason
el 24 de Oct. de 2013
Walter Roberson
el 25 de Oct. de 2013
Create indcomuse.m that contains the line
a2x1combined
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!