separating matrices and performing operation

1 回表示 (過去 30 日間)
kash
kash 2012 年 5 月 23 日
I have a code
A is a matrix
n = numel(A);
A1_30 = repmat(A,[1,1,30]);
t = ones(size(A));
for j1 = 1:size(A1_30,3)
p = t;
p(randi(n,15000,1)) = 0;
A1_30(:,:,j1) = A1_30(:,:,j1).*p;
end
A1_30 has 30 matrices,now for first 10 matrices ,i want to do some operation,next 10 another operation and last 10 anoher operation,please tell how to process these in a for loop
[Merged information from duplicate question]
I have a code
A=rand(256,256)
n = numel(A);
A1_30 = repmat(A,[1,1,30]);
t = ones(size(A));
for j1 = 1:size(A1_30,3)
p = t;
p(randi(n,15000,1)) = 0;
A1_30(:,:,j1) = A1_30(:,:,j1).*p;
end
no i want to separate these matrices int 3 parts,into 10 each for performing different operation
i need first 10 matrices in separate loop ,second in another for loop ,another 10 in another for loop,
please help
for example
for the 10 imatrix i want to convert them into bw,
for next 10;i want to resize to 128x128;PLEASE HELP,FOR next 10 another operation,please say for one operation
  3 件のコメント
kash
kash 2012 年 5 月 24 日
Walter what infromation must be edited in order to get the answere
Walter Roberson
Walter Roberson 2012 年 5 月 24 日
Removing any information in your (now merged) question that is no longer relevant would help make the question easier to understand.
People answer when they feel like answering. There are no promises of answers here. It is just after midnight in most of North America, so the North Americans are mostly in bed (which is where I will be in a few short minutes.) It is roughly 6:30 in the morning in western Europe, so the volunteers there are mostly still sleeping. You can pretty much expect another 2 to 3 hours before any of the other regular volunteers reads your question; whether they will respond at all is up to them.
If you need a response more quickly than "Sometime after morning coffee, or a few days after that perhaps", then it is recommended that you hire a consultant.
And now it is time for me to rest my aching fingers.

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

回答 (1 件)

the cyclist
the cyclist 2012 年 5 月 23 日
One possible way:
A1_30 = rand(5,5,30);
for nk = 1:3
indexToThisThird = 10*(nk-1) + (1:10);
A1_30(:,:,indexToThisThird) = nk; % Replace this line with whatever you want to do
end
  1 件のコメント
kash
kash 2012 年 5 月 24 日
I could not understand these codings
I have an matrice of A1_30 = rand(256,256,30);
from A1_30(:,:,1) to A1_30(:,:,10);i will have 10 matrices say images,for these 10 images i want to convert them into bw,
for next 10;i want to RESIZE THE IMAGE TI 128x128;PLEASE HELP,FOR next 10 another operation,please say for one operation

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by