Read files from directory, load function causing error
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!