Read files from directory, load function causing error
Afficher commentaires plus anciens
from the code below, when I run it and select the files I want, I get this error, I seem to be lost and cant figure out whats causing it> It seems to be reading letters of the file instead of the name of the file: ??? Error using ==> load Unable to read file G: No such file or directory.
G is the first letter of the file I selected.
The other problem is if i select more than one files i get this error:
??? Error using ==> fprintf Function is not defined for 'cell' inputs.
Error in ==>at line 34 fprintf('You have selected: %s\n\n',files2get)
Can someone help me?
when I change the load functions code to:
matrix = load(files2get{i,1},'%c%e%g%s%f'); i get this:
??? Cell contents reference from a non-cell array object.
Error in ==> twinleaf at 38 matrix = load(files2get{i,1},'%c%e%g%s%f');
Question=input('Do You Want To Select Files: y/n \n\n', 's')
Prompt=Question;
if strcmp(Prompt,'y')
fprintf('You selected: %s \n\n',Prompt)
fprintf('Please select the file type in the directory \n\n')
files2get = uigetfile('*.*','MultiSelect','on');
files2get={};
fprintf('You have selected: %s\n\n',files2get)
nfiles = size(files2get,1);
for i = 1:nfiles
matrix = load(files2get(i,1),'%c%e%g%s%f');
end elseif strcmp(Prompt,'n')
fprintf('You selected: %s\n\n GOODBYE',Prompt)
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Parallel Computing Fundamentals 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!