Replacing Matirx after each loop

1 visualización (últimos 30 días)
A
A el 27 de En. de 2021
Comentada: A el 2 de Feb. de 2021
suppose i have matrix A
and i do this:
A=[13 4 6; 3 6 7;2 3 5];
then i set matrices
B=[]
C=[]
and I set the highest A(1,:) value to B matirx
after doing some conditions i end up with
A=[]
B=[13 4 6; 2 3 5]
C=[3 6 7]
how would i make the B matirx the new A matirx and repeat whole process, including setting the max point again?
Would it be
A=[13 4 6; 3 6 7;2 3 5];
B=[]
C=[]
[b0,i]=max(A(1))
B(1,:)=A(i,:)
for i=1:A.length()
:
Some conditions
then A=B
end
Would that be right or doing it some other way?

Respuesta aceptada

Shashank Gupta
Shashank Gupta el 2 de Feb. de 2021
Hi,
I don't quite follow the operations you are performing, but here is the general template of such problems. It looks like a iterative problem.
% define variables
A = % define the initial A.
B=[];
C=[];
% A loop to iterate
Loop
% Do your thing here.
% update the A to B
A = B;
end
Or you can also put all these inside a function and call it multiple times. It will be more convenient and structured.
I hope this helps.
Cheers.
  1 comentario
A
A el 2 de Feb. de 2021
Hi,
Thank you so much it did help

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Industrial Statistics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by