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

2 visualizaciones (últimos 30 días)
Firas Al-Kharabsheh
Firas Al-Kharabsheh el 30 de Abr. de 2016
Comentada: dpb el 2 de Mayo de 2016
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 comentarios
Firas Al-Kharabsheh
Firas Al-Kharabsheh el 1 de Mayo de 2016
yes you solved it but this for rows matrix , on this question i want to do column in A by column
dpb
dpb el 2 de Mayo de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by