How to have user input for a m-file with in a separate script?
6 views (last 30 days)
Show older comments
Hello, I am fairly new to MATLAB and was wondering what commands i need to have a user input the name of a m-file within a separate script. I need the user to specify the name and have the main script search and subsequently launch the user specified scrip. This main script is basically a Gui interface. My code looks as follows: -----
if true
cinit %sets path of the location of separate m-files
who
%following sets main variables
cdata= input('cdata= ');
time= input('time= ');
cdata(1,:)=time;
%searching for the user specified fit
fit= input('what is the name of the fit you would like?: ','s');
if strcmpi(fit,'expfit2')
expfit2 %example of a custom fit in my path
end
end
The problem that I am having is that I have hundreds of possible custom fits in my path that I would like to be able to be to look up, and writing an if/else statements does not seem like the best approach.
0 Comments
Answers (1)
See Also
Categories
Find more on Workspace Variables and MAT-Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!