array fetching and placing in matrix
Mostrar comentarios más antiguos
I have a matrix c = [0 0 0; 0 0 0; 0 0 0] from the command c=zeros(3,3). My array p=[12,10,11,13,8,9,5]; I need to get array in c and my final value of c should be [12,10,11;9,13,8;0,0,5]. First 3 array value should be placed in first row of c, in the second row of c, it has to look the minimum value in the first row (min value =10) corresponding column it has to place the fourth value in array. Similarly fifth and sixth value in array p is placed. now in the third row of matrix c, first two rows of c has to be added to get the minimum value. after the summation minimum value is in third column so the seventh value in the array p is placed in third column of matrix c. This procedure has to be done irrespective of the array size and matrix. kindly suggest.
2 comentarios
Guillaume
el 6 de Sept. de 2016
I don't understand your algorithm. Why, when the minimum of the first row is 10, do you select the 6th value (equal to 9) of p to place in C(2, 1)?
Bathrinath
el 6 de Sept. de 2016
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Arithmetic Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!