maximum and minimum of each columns of a cell array

11 ビュー (過去 30 日間)
sam moor
sam moor 2016 年 5 月 17 日
編集済み: sam moor 2016 年 5 月 18 日
I have a cell array of 1x16. In each cell there is a number of columns and rows data. I want to find maximum and minimum of each column of each data i.e data{1,1},data{1,2}.....data{1,16} ans store in a matrix so that i can plot the graph. how do i find out maximum and minimum of such cell array data and store in a a matrix? I have attached the screenshot for clear understanding.
  1 件のコメント
Matt J
Matt J 2016 年 5 月 17 日
If all data{i,j} are the same size, then you probably should be using normal numeric arrays, instead of cell arrays.

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2016 年 5 月 17 日
I’m not certain how your cell array is organised, so see if this works with your data:
Data = {randi(99, 9), randi(99, 9), randi(99, 9)}; % Create Data
Max_Col_Cell = cellfun(@max, Data, 'Uni',0); % Cell Array Of Maximum Column Values
Max_Col_Num = cell2mat(Max_Col_Cell'); % Convert To Numeric Array
  2 件のコメント
sam moor
sam moor 2016 年 5 月 17 日
i found out the maximum and minimum of the data using cellfun but now how do i find out absolute value of maximum and minimum of the data
Star Strider
Star Strider 2016 年 5 月 17 日
I am not certain what you mean by ‘absolute value of maximum and minimum of the data’. If you want the absolute value (the magnitude of complex numbers or the positive value of negative numbers) use the abs function.
If you want to know the difference between the maximum and minimum for each column, subtract the minimum from the maximum.
If you want to know the maximum of all the columns in each matrix, use the max function across the maximum numbers for that matrix. Do the same to get the minimum.
If none of these does what you want, please be more specific in describing your objective.

サインインしてコメントする。

その他の回答 (2 件)

Andrei Bobrov
Andrei Bobrov 2016 年 5 月 17 日
編集済み: Andrei Bobrov 2016 年 5 月 18 日
d = cat(3,Data{:});
datamin = squeeze(min(d))';
datamax = squeeze(max(d))';

Chad Greene
Chad Greene 2016 年 5 月 17 日
You can use cellfun where the func argument is simply @max or @min.

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by