How to select a specific cell in UITable?

There is an input and I want to get the other values in the row where this input is equal to one of the values in the first column of the UITable.
I think l need something like:
idx = UITable.ColumnName.SerialNumber==3
Thanks for your help!

 Accepted Answer

[rows, ~] = find(value == UITable.Data)
UITable.Data(r,:)

7 Comments

It says:
Undefined function 'eq' for input arguments of type 'table'
If UITable is a uitable, then UITable.Data would be a table() object, and you would do something like
uit = UITable.Data;
mask = value == uit.SerialNumber;
selected_rows = uit(mask,:);
Actually it is app.UITable, but l'll try this in a few minutes.
Got en error @Walter Roberson:
Unrecognized method property or field 'SerialNumber'
UITable.Data can return any of the following types: table array, numeric array, logical array, cell array, string array, or cell array of character vectors. If you run the following command you will be able to tell what type of data you are working with:
uit = app.UITable.Data;
class(uit)
"app.UITable" implies you are working within App Designer. Within App Designer, components/functions/properties specific to the app are called with the prefix "app.". It's just a syntax error, so if you add the prefix to you code that should allow you to interface with the UITable.
I have tried your correction but errors are the same.
Once you have done
uit = app.UITable.Data;
then what shows up for
uit.Properties.VariableNames
I finally made it work by combining your answers @Taylor and @Walter Roberson Thanks a lot for your help!

Sign in to comment.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!