I am trying to create a multidimensional array with nested FOR loop.The problem iam facing is calling the pages after each iteration. Because i have to do use certain condition on each page.

clc;
clear all;
A=zeros(2,2,14);
for z =1:14
for y =1:2
for x = 1:2
A(x,y,z) =x+y+z;
end
end
end
% Need each page of A matrix

3 件のコメント

Calling pages means?
P K
P K 2018 年 8 月 5 日
Thanks for reply. By calling i mean, using each matrix out of 14 matrices from the Multidimensional matrices formed.I have to check certain condition on each matrix.
Jan
Jan 2018 年 8 月 5 日
@Ravi: Today I've formatted your code. Please use the "{} Code" button by your own. Thanks.

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

回答 (1 件)

Do you mean:
A(:, :, 1)
? "calling the pages after each iteration" is not clear.

1 件のコメント

P K
P K 2018 年 8 月 6 日
編集済み: P K 2018 年 8 月 6 日
Jan Thanks for being so patient. I would explain what I am trying to do. I want a cell with dimension(14,1). Each Matrix of the cell should contain only 0 and 1. That means there would be 14 matrices. The number of 1 and 0 are fixed in each matrix. There are three 1 and five 0 in each matrix. Suppose A is one of the matrices then the conditions are sum(A(:,1))>=1 and A(4,:)=0. Basically, A=[1 0;1 0;0 1;0 0] would be one of the matrix.
Appreciate your help.

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

カテゴリ

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

質問済み:

P K
2018 年 8 月 5 日

編集済み:

P K
2018 年 8 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by