How can I send data of the type "string" and "numeric" to a uitable?
2 views (last 30 days)
Show older comments
Good afternoon. I annoy them again with a new concern. I'm making a GUI that has 2 tables:
1) The first call "TablaDatosElementos", which consists of 7 fixed columns and "n" rows, of the numerical values that are put in columns 6 and 7 is obtained the variable called "N_I_F" (a variable that tells me the numerical data of a vector without repeating them) and a variable "N_I_F_R" that records what these numerical data were.
2) The other table is called "Table_Rest" and has 2 fixed columns and "N_I_F" rows. I send this table the data of the vector "N_I_F_R" in its second column. The table "Table_Rest" in its first column has a "Choice list" of 4 options (in the form of a string) for each cell of said column (that is, the number of cells depends on the variable "N_I_F")
The doubt is the next one. After sending the data from "N_I_F_R" to "Table_Rest" and selecting some of the 4 Table options (in its first column) it shows me "NaN" instead of the option I selected, and I think that this problem is because the table is being worked as double, so I require that the data in the first column (column where the 4 options are) is handled as a string and the second is handled as a numeric data.
Thank you very much and I would appreciate your help. Here is my code.
% --- Creacion de filas de la tabla "restricciones" de acuerdo al conteo de nodos
N_I_F_R=unique(B1);
num_elem_Rest=cell(N_I_F,2);
num_elem_Rest(:,:)={''};
set(handles.Table_Rest,'data',num_elem_Rest);
%------------------ LLenado de tabla de Nodos ---------------
i=1;
T_rest=get(handles.Table_Rest,'Data');
T_rest=[,];
for i=1:N_I_F
T_rest(i,2)=N_I_F_R(i,1);
end
set(handles.Table_Rest,'data',T_rest);
6 Comments
Image Analyst
on 17 Aug 2018
You said "selecting some of the 4 Table options (in its first column)". Does that not mean that you, as the user, are selecting only SOME of the items in column 1, and you want (in your code) to find out which cells were selected?
Answers (0)
See Also
Categories
Find more on Whos 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!