c - Making a new matrix from existing matrix -
i trying write code in c gets elements of existing (made before) matrix , make new matrix them. imagine have matrix r[1][303]
, , want create new matrix k[303 - n + 1][1]
stores elements of matrix r
column n
until final column (i.e. column 303). have loop on n
, , code started write like:
(n=1; n<=201; n++) { float k[303-n+1][1]=???? }
if want write in matlab, write:
n=1:201 k=[]; k(1:303-n+1,1)=r(n:end); end
but have no idea how have write part
r(n:end)
in c. appreciate if can give me hint.
i think looking for
#include <stdio.h> int main(){ int r[1][10]={{0,1,2,3,4,5,6,7,8,9}}; int j[10][1]; //printf("row %d column %d",sizeof(r)/sizeof(r[0]),sizeof(r[0])/sizeof(r[0][0])); int i; for(i=9; >5; i--){ j[i][0]=r[0][i]; } for(i=6; < 10; i++){ printf("%d \n",j[i][0]); } return 0; }
Comments
Post a Comment