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

조회 수: 1 (최근 30일)
Firas Al-Kharabsheh
Firas Al-Kharabsheh 2016년 4월 30일
댓글: dpb 2016년 5월 2일
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
Firas Al-Kharabsheh 2016년 5월 1일
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에서 MATLAB Coder에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by