Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

insert 2 lines matrix inside another matrix and conditionally repeating them

1 vue (au cours des 30 derniers jours)
Islam Hassan
Islam Hassan le 14 Juil 2020
Clôturé : MATLAB Answer Bot le 20 Août 2021
I want to integrate two lines inside matrix and repeated frequently depending on next lines like the following example:
The original matrix:
A = [ G1 X8 Y118
G0 X8 Y135
G1 X 8 Y 150
G0 X 8 Y 172
G1 X 8 Y 209
G0 X 8 Y 242
G1 X 8 Y 410
G0 X 9 Y 208
…….. ] so on
Generated matrix
AA = [
M 802
M 800 P 8
G1 X8 Y118
M802
M800 P9
G0 X8 Y135
M 802
M 800 P 8
G1 X 8 Y 150
M 802
M 800 P 9
G0 X 8 Y 172
M 802
M 800 P 8
G1 X 8 Y 209
M 802
M 800 P 9
G0 X 8 Y 242
M 802
M 800 P 8
G1 X 8 Y 410
M 802
M 800 P 9
G0 X 9 Y 208
…………] so on
So before any line begin with G1, put
M802
M800 P8
And before any line begin with G0, put
M802
M800 P9
How can we do this?

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by