The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Subtract plane from matrix data

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
white.string Posted - 04/11/2005 : 02:34:28 AM
Origin Version: 7.5G SR 3
Operating System: Windows XP

Hi,

to correct a matrix of (topographic) data to a base plane I've used the 3-point method to determine the plane, generate a new matrix of same dimension and subtract these matrix from the matrix of raw data. I've got two questions:

A) For automated processing I use 3 fixed Points. But in case of spikes the result could be quite poor. So I'd like to use a linear fitting procedure using one row and one column of the raw data. The procedure would be something like

lr data_1b

This requires to copy the data of the desired row and column into a temporary dataset. Is there a way to avoid this, i.e. to operate directly on a row or column?

B) Until now I calculate the corrected matrix by subtracting "cell-by-cell" like this:

loop(ii,1,nRow)
{
loop(jj,1,nCol)
{
%Q!cell(ii,jj)=%M!cell(ii,jj)-%A!cell(ii,jj);
};
};


where %M is the original dataset and %A is the matrix of the calculated plane. The performance on large matrices (i.e. 500x500 data) is rather poor. Is there a more elegant way in LabTalk for this job something like Matrix3 = Matrix1 - Matrix2 ?

Thanks for any comments!
Rolf
3   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 04/11/2005 : 12:10:17 PM
Hi Rolf,

%Q=%R-%S is a string operation to LabTalk...

%Q=%R-%S;
%Q=;
matrix2-matrix1

Put the LHS in parentheses to force an arithmetic operation...

(%Q)=%R-%S;
%Q=;
matrix3

...I should add that matrices are much more easily manipulated in Origin C than in LabTalk.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 04/11/2005 12:18:08 PM
white.string Posted - 04/11/2005 : 11:03:25 AM
Thank you Mike, you're always here when somebody needs help. Just great!

According B) there is still a question for me: I can do the calculation saying Matrix3=Matrix2-Matrix1 in the script window. But how can I do that using String variables?

%Q=Matrix3;
%R=Matrix2;
%S=Matrix1;

%Q=%R-%S;

apparently doesn't work (I didn't expect this). What would be the proper notation to access matrices through variables?

Thanks a lot!
Rolf
Mike Buess Posted - 04/11/2005 : 07:36:49 AM
Hi Rolf,

A) LabTalk has no method for operating on a single matrix row or column. The easiest way to operate on a column is to convert to wks, operate on desired column and convert back to matrix if necessary. To operate on a row just transpose the matrix first.

B) Matrix3 = Matrix2 - Matrix1 works if all matrices have the same size.

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000