how to do this operation to calculate columns for a new matrix ?

2 次查看(过去 30 天)
if i have this matrix
A=[ 0 0 1 0 1 0 1 4 1 0
10 10 6 5 1 1 1 5 6 10 ]
and i found this matrix
a=[ 10 10 7 5 2 1 2 9 7 10 ]
and this matrix
b = [1 1 2 1 2 1 2 2 2 1 ]
i want to find this matrix F_Complete where
for k=1:10
if (a(k) + b(k) - 1) == 10 then
go back to A(k) and make group of ones depend on the number in the column(k) ( between each group there is zero )
like this
the first column in A = [0 >>>> make the condition true then put in F_complete(:,1) [ 1
10 ] 1
1
1
1
1
1
1
1
1 ]
the second column and last column in A just like the first column
the 8 column in A = [ 4 >>>> make the condition true then put in F_complete(:,8) [ 1
5 ] 1
1
1
0
1
1
1
1
1 ]
then the final solution will be
F_Complete = [ 1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 0 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1 ]
  3 个评论
Firas Al-Kharabsheh
yes you solved it but this for rows matrix , on this question i want to do column in A by column
dpb
dpb 2016-5-2
Well, orientation shouldn't make much of a roadbloack, but primarily again your description of the rule by which you generate the output is very difficult to follow...I can't interpret how you got the above result from the input, sorry.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by