Percentage of each elements in a 3d matrix

1 回表示 (過去 30 日間)
Jonas Damsbo
Jonas Damsbo 2019 年 1 月 6 日
回答済み: dpb 2019 年 1 月 6 日
Hey
I have a 3d matric with size 359x180x360.
I want now to create a new matrix with size 359x180x360 where all the elements have percentage of a specific value, so a simple example:
A(:,:,1) = [7, 8, 12; 4, 13, 5; 11, 12, 12]
A(:,:,2) = [11, 9, 12; 6, 12, 8; 15, 15, 2]
And I want the new matrix with the percentage of values greather than 10 so I get a matrix like:
B(3,3,1) = [50, 0, 100; 0, 100, 0; 100, 100, 50]
Anyway to do that?

採用された回答

dpb
dpb 2019 年 1 月 6 日
There's no point in the output array having P planes...
V=value;
[~,~,N]=size(A);
B=100*sum(A>V,3)/N;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by