hi every body , how can I count the number of 1 and 2 and 3 in each cell that corrispond to x,y,z

clear all
clc
for i=1:10
for j=1:10
for k=1:10
A=10*randn(1)
B=10*randn(1)
C=10*randn(1)
D=10*randn(1)
E=10*randn(1)
F=10*randn(1)
X=A+B
Y=C+D
Z=E+F
[ER{i,j}(1,k), idx{i,j}(1,k)] = min([X,Y,Z]);
end
end
end

1 件のコメント

Guillaume
Guillaume 2019 年 5 月 7 日
  • Why are you using loops for this? Everything can be calculated in one line.
  • Why are you storing scalar values in a cell array? A simple 3D matrix would work
  • What 1 and 2 do you want to count? It's very unlikely that a normal distribution will contain either 1 or 2 exactly. Most likely the count is going to be 0 of each.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

リリース

R2018b

タグ

質問済み:

2019 年 5 月 7 日

コメント済み:

2019 年 5 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by