How can I get the cell array's max vaule in each cell?

1 次查看(过去 30 天)
Hi everyone,
I have get a cell (1,12) by this code ,each cell have different rows (5000~13000 rows) and 3 column. data.m is my data.
clear all;clc;
folder = 'C:\Users\Dr.Li\\NB1';
cd(folder)
f = fullfile(folder,'*.cxp');
d = dir(f);
for k = 1:numel(d);
data{k} = importfile(fullfile(folder,d(k).name));
putdata{k} = [data{1,k}(214:end,1:3)];
end
CH = {'parameter1','parameter1','parameter1'};
for k = 1:numel(d);
data{k} = importfile(fullfile(folder,d(k).name));
putdata{k} = [CH;data{1,k}(214:end,1:3)];
end
I want get the max value in each cell's first column.,and export the value's row number .
How can I to do?
Thank you
LI

回答(1 个)

Jan
Jan 2018-12-9
I assume:
maxValue = nan(1, numel(d));
maxIndex = nan(1, numel(d));
for k = 1:numel(d)
[maxValue(k), maxIndex(k)] = max(putdata{k}(:, 1));
end

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by