Retrieving Data from User using data tables in Matlab?
3 views (last 30 days)
Show older comments
I am currently trying to ask a user to select a specific data from a table of values including named variable columns. I have to ask the user to input a desired number, each associated with a gas name. The data I have has 7 gas names in column one, properties of pressure in column two for each gas, properties of temperature for each gas in column 3 ect. I am having trouble asking the user to select a specific gas from my table, I have tried assigning the gas names to the row and column that it appears in my table and then providing a list of numbers to be associated with each gas but it is not working.
A second problem that I have is to do with the associated data of pressure for the specific gas, I have so that P=('input',column number) where the input is the number chosen by the user, associated with the gas from the list of numbers I have provided. i.e; He=1.., He=(1,1);.
Thank you for your help!
3 Comments
Accepted Answer
dpb
on 22 Nov 2020
Edited: dpb
on 22 Nov 2020
gasesab.Gases=categorical(gasesab.Gases); % turn into categorical variable
inGas=listdlg('ListString',gasesab.Gases, ...
'Name','GAS PROPERTIES','PromptString', ...
'Select Desired Gas', ...
'SelectionMode','single', ...
'ListSize',[150 150]);
inProp=listdlg('ListString',gasesab.Properties.VariableNames(2:end), ...
'Name','GAS PROPERTIES','PromptString', ...
'Select Desired Properties', ...
'SelectionMode','multiple', ...
'ListSize',[150 150]);
inProp=inProp+1;
properties=gasesab(inGas,inProp); % table of desired properties for specific gas
Use
properties=gasesab{inGas,inProp}; % array of desired properties for specific gas
NB: the curlies "{}" to return as an array of properties. There, of course, you have to keep track of which elements of the array are which property so the table may be simpler.
0 Comments
More Answers (0)
See Also
Categories
Find more on Gas Models in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!