How can I send data of the type "string" and "numeric" to a uitable?

2 ビュー (過去 30 日間)
Pedro Guevara
Pedro Guevara 2018 年 8 月 17 日
コメント済み: Pedro Guevara 2018 年 8 月 17 日
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 件のコメント
Image Analyst
Image Analyst 2018 年 8 月 17 日
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?
Pedro Guevara
Pedro Guevara 2018 年 8 月 17 日
I want that for each cell created in the table "Table_Rest" one of the 4 options can be given and that when selecting the option for each cell, the selected option appears in that same cell and not the "NaN" error that currently appears. I leave you an image so that you understand better what happens
1) Here you can see that for each cell created there are my 4 options
2) but after selecting any of them I get "NaN"

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by