Clear Filters
Clear Filters

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

1 view (last 30 days)
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

Answers (1)

Jan
Jan on 9 Dec 2018
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

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!