How do I assign the value of a matrix to a cell of an object "uitable" ?
Afficher commentaires plus anciens
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 ) ;
Réponses (1)
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 commentaires
Pedro Guevara
le 5 Mai 2019
Instead of trying another shot in the dark, let's figure out why this solution doesn't work. Could you provide the values for all of the following?
- class(TablaDatosElementos)
- TablaDatosElementos.Data(:,6)
- V_org(celdas,1)
- datos(V_org(Pos_igual1x(j,1),1), 6)
If any of those lines produce an error, please provide the entire copy-pasted error message.
Pedro Guevara
le 5 Mai 2019
Pedro Guevara
le 5 Mai 2019
Pedro Guevara
le 5 Mai 2019
Pedro Guevara
le 5 Mai 2019
Pedro Guevara
le 5 Mai 2019
Pedro Guevara
le 5 Mai 2019
Adam Danz
le 5 Mai 2019
The screen shots are more difficult to follow than just copy-pasting the text but at a quick glance, everything looks OK. The value you are assigning is 0 and the previous value is also 0 so that value won't change. Why do you say that this isn't working? Is there an error message?
Pedro Guevara
le 6 Mai 2019
Adam Danz
le 6 Mai 2019
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
le 6 Mai 2019
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.
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





