Integrate new rows inside matrix and repeating them
Show older comments
I want to integrate two lines inside matrix and repeated frequently before each rows:
The original matrix:
A = [ G1 X8 Y118
G1 X8 Y135
G1 X 8 Y 150
G1 X 8 Y 172
G1 X 8 Y 209
G1 X 8 Y 242
G1 X 8 Y 410
G1 X 9 Y 208
…….. ] so on
Generated matrix
AA = [
M 802
M 800 P 8
G1 X8 Y118
M802
M800 P8
G1 X8 Y135
M 802
M 800 P 8
G1 X 8 Y 150
M 802
M 800 P 8
G1 X 8 Y 172
M 802
M 800 P 8
G1 X 8 Y 209
M 802
M 800 P 8
G1 X 8 Y 242
M 802
M 800 P 8
G1 X 8 Y 410
M 802
M 800 P 8
G1 X 9 Y 208
…………] so on
So before any row, put these two rows
M802
M800 P8
How can we do this?
2 Comments
Image Analyst
on 19 Jul 2020
Edited: Image Analyst
on 19 Jul 2020
Are M, P, G1, etc. all variables of double class? Your AA matrix can't have some rows with two columns, like M and 802, and other rows with 3 columns, like [G1, X8, Y118] or 4 columns like [M, 800, P, 8]. Matrices have to be rectangular, meaning no ragged right edge. All rows must have the same number of columns.
And you tagged this image processing. What does this have to do with image processing???
Islam Hassan
on 19 Jul 2020
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!