12-07-2005 11:50 AM
12-07-2005 04:52 PM - edited 12-07-2005 04:52 PM
Hi calvinf15.
In the Advanced Analysis Library (assuming you have it**), you will find this function:
AnalysisLibErrType Transpose (void *Input_Matrix, int Number_of_Rows, int Number_of_Columns, void *Output_Matrix);
Finds the transpose of a 2D input matrix. Transpose obtains the (i, j)th element of the resulting matrix using the following formula:
yi, j = xj, i
Note If the input matrix has n-by-m dimensions, the output matrix must have m-by-n dimensions.
Use memmove() to make space in Input_Matrix for the new data, insert your latest result(s), then call Transpose(), and use Output_Matrix (separate array) as the data for the intensity plot.
Note that this will only work for arrays of doubles; for other data types, you could call ConvertArrayType() before Transpose().
Regards,
Colin.
** Otherwise, you could try TransposeData() from Programmer’s Toolbox. Unfortunately, this function operates on the data “in-place”, so you would need to call it twice per iteration.
Message Edited by cdk52 on 12-08-2005 08:56 AM
12-07-2005 06:23 PM
Hi again.
I just read your post more carefully, and realised that you probably don't need to transpose your data; you just need to shift it.
Hope that helps.
Regards,
Colin.
12-07-2005 08:13 PM
12-07-2005 09:50 PM
Hi Calvin.
Here is the function help text for memmove():
"This function copies a specified number of bytes from a source buffer to a target buffer. Copying takes place as if the bytes to be copied are first copied into a temporary array that does not overlap the target and source buffers. This allows this function to copy bytes even when overlap occurs."
...so there is no fiddling about with pointers here. Operations such as this in C are very efficient; I wouldn't be concerned about the time taken unless you are working with extremely large arrays and very short intervals between chart updates. Try it and let us know how you go.
Regards,
Colin.