separating matrices and performing operation

2 visualizaciones (últimos 30 días)
kash
kash el 23 de Mayo de 2012
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 comentarios
kash
kash el 24 de Mayo de 2012
Walter what infromation must be edited in order to get the answere
Walter Roberson
Walter Roberson el 24 de Mayo de 2012
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.

Iniciar sesión para comentar.

Respuestas (1)

the cyclist
the cyclist el 23 de Mayo de 2012
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 comentario
kash
kash el 24 de Mayo de 2012
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

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by