Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

insert 2 lines matrix inside another matrix and conditionally repeating them

1 visualizzazione (ultimi 30 giorni)
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?

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by