function which calls M-File and set their variables
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Hi guys,
Is it possible to write a function which first take 1 input from user and based on that open one of two M-Files and after that ask user again now to enter the variables in that already called M-File??
thx,
1 Comment
Guillaume
on 18 Dec 2019
It may be just a matter of semantic but opening an m file is typically done in order to edit the file. On the other hand, code typically run m file, which is a different operation.
It is trivial to decide which m code to run based on user input.
It's not very clear what you want to do with the second part of your question. If you're asking that the code then change actual values that are hardcoded in the m file, then you need to rethink your design and use functions with inputs.
Answers (1)
"Is it possible to write a function which first take 1 input from user and based on that open one of two M-Files ..."
Yes. There are lots of ways to get input from a user. If you're asking the user to open a file, you could used
function output = myFunction(input)
[file,path] = uigetfile(filter, title); % See link above
end
"... and after that ask user again now to enter the variables in that already called M-File?"
Here are ways to get that input from the user
lots more....
If you get stuck, share your updated code and describe what's wrong; I'd be glad to help out.
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!