Retrieving Data from User using data tables in Matlab?
2 次查看(过去 30 天)
显示 更早的评论
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!
采纳的回答
dpb
2020-11-22
编辑:dpb
2020-11-22
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 个评论
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!