Borrar filtros
Borrar filtros

Add letters to the first and third column of matrix

2 visualizaciones (últimos 30 días)
Islam Hassan
Islam Hassan el 13 de Jul. de 2020
Comentada: Islam Hassan el 13 de Jul. de 2020
I want ot add letter to first columnmatrix like this:
A = [ 3 6
5 7
5 8
7 8
. ... ... ]
to be:
AA = [ G1 X 3 Y 6
G0 X 4 Y 7
G1 X 5 Y 8
G0 X 7 Y 8
. ... ....]
How can we do this G1 for odd rows and G0 for even rows

Respuesta aceptada

madhan ravi
madhan ravi el 13 de Jul. de 2020
Editada: madhan ravi el 13 de Jul. de 2020
AA = [repmat("G1",size(A(:,2))), "X "+A(:,1), "Y "+A(:,2)]
  3 comentarios
madhan ravi
madhan ravi el 13 de Jul. de 2020
AA = ["G"+mod(1:size(A(:,2)),2).', "X "+A(:,1), "Y "+A(:,2)]
Islam Hassan
Islam Hassan el 13 de Jul. de 2020
Thanks a lot that works

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by