How to use selection from list menu
Ältere Kommentare anzeigen
Hello all!
I have a simple gui menu to select a few options (in this case: H, H2 and H20). When I select the options, I would like to run the respective script file.
For instance - If I select 'H' I want it to run the S1_H.m script file, if I select H2 I want it to run S2_H2.m file and etc.
My code is as below, it 'seems' to work for first selection (which is H) but not the rest. When I select the 2nd and 3rd option, it still runs the first script file. What am I doing wrong?
I added the following line (species = vertcat(ListString);) to try to convert the cell array so I can use the values, but it seems that I get an error without it saying that "Conversion to logical from cell is not possible.", when I try and use list(1,1) instead.
list = {'H','H2','H20'};
[indx,tf] = listdlg('ListString',list);
species = vertcat(ListString);
if species (1,1)
S1_H
elseif species (1,2)
S2_H2
elseif species (1,3)
S3_H20
end
thank you in advance!!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Simulink Environment Customization finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!