Go Down

Topic: How to manipulate a matrix. (Read 672 times) previous topic - next topic

vallesvera.manuel

Lets say I have..
int matrix[5][5]={{0,0,0,0,0},{1,1,1,1,1},{2,2,2,2,2},{3,3,3,3,3},{4,4,4,4,4}};
How do I manipulate this matrix to make it look like...
{{0,0,0,0,0},{0,0,0,0,0},{1,1,1,1,1},{2,2,2,2,2},{3,3,3,3,3}}
then
{{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{1,1,1,1,1},{2,2,2,2,2}}
and so on.....
What I basically want to do is shift every row down by one or up by one.
Any suggestions???

johnwasser

Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

westfw

What John meant is that C has not particular magic functions to do any matrix manipulation; you have to do it yourself, one element at a time...

AWOL

Quote
you have to do it yourself, one element at a time...

Or a row ata time, using memcpy
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Go Up