array fetching and placing in matrix
显示 更早的评论
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 个评论
Guillaume
2016-9-6
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
2016-9-6
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Arithmetic Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!