Variable feeding into a function
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Yewande Oni
el 3 de Sept. de 2015
Comentada: Star Strider
el 3 de Sept. de 2015
How can I get a variable from one script to feed into a function? Hope that makes sense?
0 comentarios
Respuesta aceptada
Star Strider
el 3 de Sept. de 2015
If the function is in its own function .m-file in your MATLAB search path, just call the function in your script with that variable as an argument to the function, just as you would any other function.
2 comentarios
Star Strider
el 3 de Sept. de 2015
Thank you anyway!
I don’t quite understand what you’re doing. It might be easiest to call your function from the script that creates the filename and pass the filename as an argument to the function.
If the function really isn’t a function but is instead another script, the easiest way I can think of just now is to write the filename to a .mat file with a specific name, then have your other script read that .mat file and get the name from it. That’s how I would do it (but then my code isn’t always as efficient as it could be).
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!