how to do this operation to calculate columns for a new matrix ?
2 views (last 30 days)
Show older comments
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 Comments
dpb
on 2 May 2016
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.
Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!