Hello, i have been running a code during some time and it worked. However now, i am trying to run it and it does not run because of this error message:
??? Undefined function or variable 'files'.
Error in ==> after_all at 20 coord = regexp(files,'\d+(\.\d+)?','match'); % It extracts the coordinates from the name of each file
The problem is the variable files (The size of the indicated variable or array appears to be changing with each loop iteration) it says…
Can anyone help me, please?
This is my code:
clear all; % clear all variables
close all; % close all plot windows
clc; % clear the command window
workfolder='C:\Users\Jorge\Desktop\Airfoil_BASELINE_Measurements\Airfoil_BASELINE_Measurements\Re140k00deg'; % It defines the folder (rpm or Re) to run
folders=[ % It indicates that in the folder selected we are interested in the Hot Wire measurements
{'cdaq2mod2_ai0-hw\'} {'cdaq2mod2_ai1-hw\'} ]; file_data=dir([workfolder folders{1} 'x*.dat']); %Inside the hot wire measurements we look for all the files with an "x" in its name
for i=1:length(file_data); files(i,1)={file_data(i).name}; % It creates a variable with all the names of the files
end % files=[
% {'x_+0.000mm_y_+0.000mm_z_+0.000mm.dat'}
% {'x_+0.000mm_y_+5.000mm_z_+0.000mm.dat'}
% ];
coord = regexp(files,'\d+(\.\d+)?','match'); % It extracts the coordinates from the name of each file
xyzCoords = cell2mat(cellfun(@(x)str2num(char(x))',coord,'UniformOutput',false)); % It organize the coordinates properly
Best Answer