Problem reading from a table using MATLAB v14
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
Can somebody help me to figure this out to read from table stored as RowID.mat? I simply need to read the second column and throd columns from RowID table as shown but I am getting an error as shown.
Thanks in advance.
load RowID.mat
for id=1:length(textFiles)
for ix=1:1:16
AnnualZ1(ix,id)=sum(Z1cell{id}([RowID(ix,2) RowID(ix,3)],:));
end
end
Error:
Error using subsindex
Function 'subsindex' is not defined for values of class 'table'.
RowID
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150102/image.bmp)
0 commentaires
Réponse acceptée
Peter Perkins
le 18 Mai 2015
I suspect that rather than
[RowID(ix,2) RowID(ix,3)]
you want
RowID{ix,2:3}
As it is, it looks like you're using a table as a subscript, which is not allowed. An alternative might be
[RowID.startDate(ix) RowID.endDate(ix)]
Rule: parenthesis subscripting on a table returns a table. Dot and brace subscripting on a table returns the contents of a table. Hope this helps.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur LaTeX dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!