More information:
I am having 5 .mat files. Each mat file contains 5 parameters. A,B,C,D,E. The 5 files are named Trial1.mat, ....., Trial5.mat
I want to take B variable which is of a size 200x1 from each mat file, convert values less than 20 to 0 and greater than 20 to 1.
0 shows system is OFF 1 Shows system is ON
Now I want to check how many times 1 is followed by 0.
I want to count this occurrence for each .mat file and give an output file which will give number of count per mat file.
Here is the for loop available to put the code:
myFolder = 'C:\Users\adi\Documents\MATLAB\';
if ~isdir(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder);
uiwait(warndlg(errorMessage));
return;
end
filePattern = fullfile(myFolder, '*.mat');
matFiles = dir(filePattern);
for k = 1:length(matFiles)
end
I hope now you got my question!