Using the listdlg index to select an array
Afficher commentaires plus anciens
Hi,
I'm a beginner at using laptop and I've hit problem with using the index value given out of the listdlg function to select an array.
I've been racking my brain how to do this, but I obviously haven't managed to get the syntax right.
Im aware it could probably be done using 'if statements,' but due to the intentions of the projects it seems a bit of a long-winded way to go about it.
Anyway, any help with this would be so greatly appreciated.
Thanks.
The code ive used so far:
MATW = {'Curtain','Glass','Plaster','Plasterboard','Wood','Acoutic Treatment'};
MATF = {'Concrete or Tile','Carpet On Foam'};
MatNumb = [1,2,3,4,5,6 ];
MatNumb(1) = [0.14 0.35 0.55 0.72 0.70 0.65];
MatNumb(2) = [0.35, 0.25, 0.18, 0.12, 0.07, 0.04];
MatNumb(3) = [0.013, 0.015, 0.02, 0.03, 0.04, 0.05];
MatNumb(4) = [0.29, 0.10, 0.05, 0.04, 0.07, 0.09];
MatNumb(5) = [0.28, 0.22, 0.17, 0.09, 0.10, 0.11];
MatNumb(6) = [0.05, 0.22, 0.52, 0.56, 0.45, 0.32];
ConcreteT = [0.01, 0.01, 0.015, 0.02, 0.02, 0.02];
CarpetF = [0.08, 0.24, 0.57, 0.69, 0.71, 0.73];
Backwall = 'Please state the area (m2) for the back wall: ';
BWA = input(Backwall);
[BWM] = listdlg('PromptString','Select Backwall Material:',...
'SelectionMode','single',...
'ListString',MATW);
BWA*MatNumb(BWM)
end
Réponse acceptée
Plus de réponses (1)
Tobias Welby
le 18 Mar 2017
0 votes
1 commentaire
Star Strider
le 18 Mar 2017
As always, my pleasure!
Catégories
En savoir plus sur Polymers dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!