یک سوال فوری، ممنون میشم سریع جواب بدید
یک کد از گوگل مربوط به تبدیل کد اسکی به متلب دانلود کردم، میخوام تعداد زیادی Asciiفایل رو لود کنه و به matlab فایل تبدیل کنه، ولی مشکل داره و برای یک فایل اوکی هست ولی وقتی چندتا فایل رو بهش میدم خطا میگیره، کد رو پایین گذاشتم
%%Created: 2017-08-10
function asc_to_mat_converter()
% The function lets you select a single asc file as well as multiple files (ctrl A)
% from a directory and converts it into mat files in the same location. The keys
% data:, textdata:, and colheaders: can be used to access the data, text headers and
% column names respectively from the file.
% Select different ascii files
[FileName,PathName,~] = uigetfile('*.asc','MultiSelect','on');
% Check if multiple files where chosen
if(iscell(FileName))
% Create a waitbar
h_wait = waitbar(0,'Starting');
% Retrieve the amount of files
numfiles = length(FileName);
% Calculate amount of steps
steps = 0.5 / numfiles;
% Set the counter
j = 1;
% Loop through each file
for i = 1 : numfiles
% Retrieve filename
filename = FileName{i};
% Retrieve the name without the extension
[~, name, ~] = fileparts(filename);
% Load the ascii file into matlab
waitbar(steps * j,h_wait,['Reading file ' num2str(i) ' from ' num2str(numfiles)]);
asciiFile = dlmread([PathName '/' filename], '-ascii');
delimiter = '\t';
headerLines = 38;
asciiFile = importdata([PathName '/' filename], delimiter, headerLines);
% Increase count
j = j + 1;
% Save the file in the same directory
waitbar(steps * j,h_wait,['Writing file ' num2str(i) ' from ' num2str(numfiles)]);
save([PathName '/' name '.mat'],'asciiFile');
% Increase count
j = j + 1;
end
close(h_wait);
else
% Avoids the loop when only single file is chosen
filename = FileName;
% Retrieve the name without the extension
[~, name, ~] = fileparts(filename);
% Load the ascii file into matlab
delimiter = '\t';
headerLines = 38;
asciiFile = importdata([PathName '/' filename], delimiter, headerLines);
% Save the file in the same directory
save([PathName '/' name '.mat'],'asciiFile');
end