![]() |
| ||
| Transpose matrix (w\ pointers) Hello, Okay I'm stumped and can't figure out why this code chunk isn't working properly (works on square matrixs; everything else doesn't work).... uint8 * imageTranspose( uint8 *im ){ uint8 *im_transpose; int x, y, org_offset, tran_offset; int im_size = dims[0] * dims[1]; if ( (im_transpose = malloc(sizeof(uint16) * im_size)) == NULL ) mexErrMsgTxt("trans im malloc failed...\n"); //Transpose for(x=0;x<dims[0]; x++){ for(y=0;y<dims[1]; y++){ org_offset = x+(y*dims[0]); //So X=X & Y=Y tran_offset= y-(x*dims[1]); //So X=Y & Y=X *(im_transpose+tran_offset) = *(im+org_offset); //mexPrintf("%d\t%d\n",*(im+org_offset),*(im_transpose+tran_offset)); } } return im_transpose; } At the end of the day I will not be using Matlab and therefore I'm just using it as a prototyping tool. Does anyone have any ideas by chance? Thanks, Anthony |
| ||
| Re: Transpose matrix (w\ pointers) I might do a transpose like this. #include <stdio.h> |
| ||
| Re: Transpose matrix (w\ pointers) I like that - that looks good. Thanks, Anthony |
| ||
| Re: Transpose matrix (w\ pointers) 100% correct matrix Transpose program with out any pointer without any complicity. ------------------------------------------------------------------- #include<stdio.h> |
| ||
| Re: Transpose matrix (w\ pointers) Nice job reviving a 2 year old thread? ;) |
| All times are GMT -4. The time now is 4:08 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC