MATLAB Answers

How do I assign the value of a matrix to a cell of an object "uitable" ?

2 ビュー (過去 30 日間)
Pedro Guevara
Pedro Guevara 2019 年 5 月 5 日
編集済み: Adam Danz 2019 年 5 月 6 日
Good afternoon. I request your help again. I have a data of a matrix (right part of the equality) that I want to send specifically to a position (V_org (cells, 1), 6) of a table called "TableDataElements". I already tried this code, but I can not get the data to appear in the table. Could someone help me? Thank you.
TablaDatosElementos ( V_org ( celdas, 1 ) , 6 ) = datos ( V_org (Pos_igual1x (j,1) , 1 ) , 6 ) ;

  0 件のコメント

サインイン to comment.

回答 (1 件)

Adam Danz
Adam Danz 2019 年 5 月 5 日
編集済み: Adam Danz 2019 年 5 月 5 日
Assuming "TablaDatosElementos " is the handle to your uitable, you must assign the value to the 'Data' field.
TablaDatosElementos.Data(V_org(celdas,1),6) = datos(V_org(Pos_igual1x(j,1),1), 6);
This assumes "V_org(celdas,1)" indicates the row number and the right side of the equality produces a scalar value.

  13 件のコメント

表示 10 件の古いコメント
Adam Danz
Adam Danz 2019 年 5 月 6 日
But again, in the example you shared with me, when you execute this line:
TablaDatosElementos.Data(V_org(celdas,1),6) = datos(V_org(Pos_igual1x(j,1),1), 6);
datos(V_org(Pos_igual1x(j,1),1), 6) equals 0
and
TablaDatosElementos.Data(V_org(celdas,1),6) equals 0
so it appears that the correct value is being assigned when you execute that line.
Are you sure TablaDatosElementos is the correct handle to the UI table you're looking at?
Pedro Guevara
Pedro Guevara 2019 年 5 月 6 日
I'm sure it's named like that. The tag is "TablaDatosElementos"
Adam Danz
Adam Danz 2019 年 5 月 6 日
In the example you shared you're assigning the value zero to one element of the uitable that already contains a value of 0. Since that's the only example I've seen, it appears that your code is working perfectly.
Perhaps the values being produced that go into the table are incorrect.
If you can provide a segment of code and input values that reproduce what you're seeing, I'd be glad to look at it. So far, everything I've seen looks normal.

サインイン to comment.

サインイン してこの質問に回答します。

製品


リリース

R2017b

Translated by