Launch a file with a popupmenu without Switch

Hi everyone ,
i have a question about popupmenu :
rep_moteur = '.\modele\electrique';
ext_moteur = '*.m';
chemin1 = fullfile(rep_moteur,ext_moteur);
list_moteur = dir(chemin1);
set(handles.modele_2, 'String', {'',list_moteur.name})
The files are : ME_1.m and ME_2.M
i got this code to put the 2 Files from the folder in a popupmenu call : modele_2
How could i launch the file Selected ? ( it's about the String i think )
if select ME_2.M , it launch and save the variables.
ME_2
save ME_2.mat;
Thank you !

답변 (1개)

Sabarinathan Vadivelu
Sabarinathan Vadivelu 2014년 7월 31일
편집: Sabarinathan Vadivelu 2014년 7월 31일

0 개 추천

If it is a script, Just include the file name " ME_1 " in the editor window.
Like this:
str = str2double(get(handles.modele_2,'String'));
switch str
case 1
ME_1
case 2
ME_2
end

댓글 수: 3

Hugo
Hugo 2014년 7월 31일
편집: Hugo 2014년 7월 31일
I did a Switch way but i don't want because it need to create all the case about the motors . later the folder will contain 20 or more Motor that's why i would like to be able to launch the file about the string selected.
Please show your code
Hugo
Hugo 2014년 7월 31일
편집: Hugo 2014년 8월 1일
It's ok i've find the solution.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 App Building에 대해 자세히 알아보기

질문:

2014년 7월 31일

편집:

2014년 8월 1일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by