フィルターのクリア

maximum value in each column

3 ビュー (過去 30 日間)
alireza bakhshaee
alireza bakhshaee 2018 年 4 月 10 日
回答済み: Bob Thompson 2018 年 4 月 10 日
Hi all, I have 28 text files. each text file has 11 columns. I have to skip first 3 lines of each text file then read them. 1-How can I find the maximum number of each column in each text files? 2-how can I find the most maximum number of each column in the previous question in 28 files?

回答 (1 件)

Bob Thompson
Bob Thompson 2018 年 4 月 10 日
There is a function for finding maximums, max(), which finds the maximum value of a specified region. All you need to do is index the function to see each column and then run a for loop.
for k = 1:size(filelist); % Run through each file
for j = 1:size(filedata,2); % Run through each column of a given file
datamaxes(k,j) = max(filedata(:,j)); % Find max of column and store data
end
end
for j = 1:size(datamaxes,2); % Run through each column again for maximax value
maximax(j) = max(datamaxes(:,j)); % Find max value of given column for all files
end

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by