subsindex error
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Walter Roberson
il 16 Apr 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su LaTeX in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!