Find maximum of an array in a for loop?
I need to calculate the maximum of each array from the load variable in the following for loop.
myDir = uigetdir;
myFiles = dir(fullfile(myDir,’*.txt’));
for k = 1:length(myFiles)
baseFileName = myFiles(k).name;
fullFileName = fullfile(myDir, baseFileName);
fprintf(1, ‘Now reading %sn’, fullFileName);
num = readmatrix(fullFileName);
load = num(:,1)
ext = num(:,3)
plot(ext,load); hold on
grid on;
endI need to calculate the maximum of each array from the load variable in the following for loop.
myDir = uigetdir;
myFiles = dir(fullfile(myDir,’*.txt’));
for k = 1:length(myFiles)
baseFileName = myFiles(k).name;
fullFileName = fullfile(myDir, baseFileName);
fprintf(1, ‘Now reading %sn’, fullFileName);
num = readmatrix(fullFileName);
load = num(:,1)
ext = num(:,3)
plot(ext,load); hold on
grid on;
end I need to calculate the maximum of each array from the load variable in the following for loop.
myDir = uigetdir;
myFiles = dir(fullfile(myDir,’*.txt’));
for k = 1:length(myFiles)
baseFileName = myFiles(k).name;
fullFileName = fullfile(myDir, baseFileName);
fprintf(1, ‘Now reading %sn’, fullFileName);
num = readmatrix(fullFileName);
load = num(:,1)
ext = num(:,3)
plot(ext,load); hold on
grid on;
end for loop, max MATLAB Answers — New Questions