[ 0.12 0.23 0.34 ;
0.45 0.56 0.67 ;
0.78 0.89 0.90 ]
Enter a’coordinates’ matrix with a bunch of rows?
[ 1 1 0.12 ;
1 2 0.23 ;
1 3 0.34 ;
2 1 0.45 ;
2 2 0.56 ;
2 3 0.67 ;
3 1 0.78 ;
3 2 0.89 ;
3 3 0.90 ]
(The arrangement of rows is irrelevant, only The data is only important in this structure)
Now I am using a for loop, but it takes a long time.
mat= [0.12 0.23 0.34 ;
0.45 0.56 0.67 ;< br /> 0.78 0.89 0.90] ;[I,J] = ind2sub(size(mat), 1:numel(mat));r=[I', J', mat(:)]r = 1.0000 1.0000 0.1200 2.0000 1.0000 0.4500 3.0000 1.0000 0.7800 1.0000 2.0000 0.2300 2.0000 2.0000 0.5600 3.0000 2.0000 0.8900 1.0000 3.0000 0.3400 2.0000 3.0000 0.6700 3.0000 3.0000 0.9000
Please note that the index is opposite compared to your example.
div>
How to rotate the matrix:
[ 0.12 0.23 0.34 ;
0.45 0.56 0.67 ;
0.78 0.89 0.90 ]
Enter a’coordinates’ matrix with a bunch of rows?
[ 1 1 0.12 ;
1 2 0.23 ;
1 3 0.34 ;
2 1 0.45 ;
2 2 0.56 ;
2 3 0.67 ;
3 1 0.78 ;
3 2 0.89 ;
3 3 0.90 ]
(The arrangement of rows is irrelevant, only The data is important in this structure)
Now I am using a for loop, but it takes a long time.
This is a Options for using ind2sub:
mat= [0.12 0.23 0.34 ;
0.45 0.56 0.67 ;
0.78 0.89 0.90] ;[I,J ] = ind2sub(size(mat), 1:numel(mat));r=[I', J', mat(:)]r = 1.0000 1.0000 0.1200 2.0000 1.0000 0.4500 3.0000 1.0000 0.7800 1.0000 2.0000 0.2300 2.0000 2.0000 0.5600 3.0000 2.0000 0.8900 1.0000 3.0000 0.3400 2.0000 3.0000 0.6700 3.0000 3.0000 0.9000
Please note that the index is the opposite compared to your example.
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2647 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC