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!

 Respuesta aceptada

Taylor
Taylor el 4 de Dic. de 2023
[rows, ~] = find(value == UITable.Data)
UITable.Data(r,:)

7 comentarios

piston_pim_offset
piston_pim_offset el 4 de Dic. de 2023
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,:);
piston_pim_offset
piston_pim_offset el 4 de Dic. de 2023
Editada: piston_pim_offset el 4 de Dic. de 2023
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.
piston_pim_offset
piston_pim_offset el 5 de Dic. de 2023
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
piston_pim_offset
piston_pim_offset el 5 de Dic. de 2023
I finally made it work by combining your answers @Taylor and @Walter Roberson Thanks a lot for your help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Centro de ayuda y File Exchange.

Preguntada:

el 4 de Dic. de 2023

Comentada:

el 5 de Dic. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by