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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 convert not uniformly spaced data to the matrix
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

OndrejM

Australia
Posts

Posted - 04/08/2008 :  12:16:10 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi Guys,

I need some help with converting my worksheet to matrix, my data look as it is shown in the picture,. i.e. first row are X-values and first column are Y values (as you can immediately see the data are not uniformly spaced! and that is problem, how can I covert this type of data to the matrix, Ive tried Direct Convert but it doesnt seems to work properly,

Many Thanks
Ondrej

Laurie

USA
404 Posts

Posted - 04/08/2008 :  2:45:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You'll need to first convert the data to XYZ and then from there convert to matrix.

If you have 7.5 or earlier or you upgraded to Origin 8, you can open the CONVERT.OTW file that existed in earlier versions of Origin. It will be located in the BUTTONS subfolder of the Origin program folder. For example, in Origin 7.5, you can find it here: C:\Program Files\OriginLab\Origin75\BUTTONS

To open the template, click the "Open Template" button on the Standard Toolbar. Change the Files of Type to Workbook Template (*.otw). Browse to the BUTTONS folder and open the CONVERT.OTW Template. Follow the instructions provided in this new window.


Instead of using this template, you could use the following script:

wo -d;
get wcol(1) -e last;
last -= 1;
wks.col1.name$ = FirstColumn;
wks.col = 2;
wks.insert(FirstRow);
wo -a 1;
tempcol = wks.ncols;
copy -b 2 wcol(1) wcol(tempcol) -b 2 -e $(last+1);
wo -a 1;
copy wcol(1) wcol(tempcol);
set wcol(tempcol) -e $(last+1);
for(col = 3 ; col < tempcol ; col++) {
wcol(wks.ncols)[col - 1] = wcol(col)[1];
}
mark -d wcol(1) -b 1 -e 1;
for(col = 4 ; col < tempcol ; col++) {
copy -a wcol(tempcol) wcol(1);
doc -uw;
copy -a wcol(col) wcol(3);
}
for(col = 4 ; col <= tempcol ; col++) {
delete wcol(4);
}
numgrp = tempcol - 3;
for(n = 1,thisrow = 1 ; n <= numgrp ; n++,thisrow += last) {
set wcol(2) -b thisrow;
set wcol(2) -e thisrow + last - 1;
wcol(2) = wcol(4)[n];
doc -uw;
}
set wcol(2) -b 1;
delete wcol(4);
wks.col3.name$=ZData;
wks.col3.type=6;
doc -uw;

Select Window : Script Window and paste the above script into this window. Highlight the entire block of script and press Enter. You'll get a new workbook with the result of three columns, X Y and Z.

OriginLab Technical Support
Go to Top of Page

OndrejM

Australia
Posts

Posted - 04/08/2008 :  8:55:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Laurie,

thanks a lot, both methods work great!

Cheers
Ondrej
Go to Top of Page

jlw2000

USA
Posts

Posted - 04/08/2008 :  9:51:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Probably due to large data that I have (2049x194), I cannot copy-paste the whole data to the template, but the script method works.

The sheet is now converted to XYZ ( scrolling down, X varies first, then repeated for different Y, and so on).

However converting it to matrix is something that I am still puzzled at.
If I use Direct, the plot from the matrix is wrong.
If I select the Z column and try Random XYZ it says "Error! Failed to sort and /or replace duplicates with mean value"

Please help,

JL
Go to Top of Page

easwar

USA
1965 Posts

Posted - 04/09/2008 :  9:36:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi JL,

Once you transform your data to XYZ then you should not use direct conversion of course...you need to use a gridding method. What version of Origin are you using? Which random gridding method did you choose?

In Origin 8, we have added more methods for gridding including Thin Plate Spline which follows the data closer than other methods. So if you do not have Origin 8 you may want to try this in the demo.

Easwar
OriginLab


Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000