ERROR: "Assignment has more non-singleton rhs dimensions than non-singleton subscripts"
Afficher commentaires plus anciens
Hello everyone, I am trying to debug an error in my code, but I am not sure what the problem is. I think it might be very simple, but I am not catching it. I have a list of .mat files in my current working directory, and I want to store specific file names in a variable "Incl". These file names begin with "PE". Here is my code:
DIR = dir;
STRCMP = 'PE';
for I = 1:length(DIR),
TF(I) = strncmpi(DIR(I).name,STRCMP,2);
end
%Logical 1 if PE file is found or 0 if PE file is not found
Ind = find(TF);
%Stores index location of each PE file (to be compared with DIR)
for J = 1:length(Ind)
Incl(J,1) = DIR(Ind).name;
end
My problem is during the last for loop. I am trying to call upon the specific file names in my directory that correspond to the index values I stored. These Dir(Ind).name variables are char format. I am trying to store them into Incl. Can anyone help me determine why I am getting this error?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements 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!