subsindex error
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
In this piece of script I am trying to use a shortcut adapted from another script so that I don´t have to write out each file name I want to import.
%open right path
cd (PATHIN)
%read in all -vhdr files
list=dir('*.vhdr');
len=length(list);
SUBJ=cell(1,len);
Here I check what SUBJ is and get [] [] as the answer...So then I start the for loop to read in the data:
for s=1:len(SUBJ)
And it gives me an error which says- Error using subsindex. Function ´subsindex´ is not defined for values of class ´cell´.
I am guessing that when I write
len=length(list);
I am converting the list into a numerical value of the number of files so that are in the directory. What should I write instead?
Thanks in advance for the help! JD
0 comentarios
Respuesta aceptada
Walter Roberson
el 16 de Abr. de 2012
You are trying to access your scalar variable "len" at an index which is a cell array "SUBJ".
If you meant length(SUBJ) instead of len(SUBJ) then you might as well use
for s=1:len
since you have already assigned len to be length(SUBJ)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre LaTeX en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!