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 for Programming
 LabTalk Forum
 Convert XYZ Data to Matrix and plot 3D Bars
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Mo3bius

5 Posts

Posted - 08/09/2010 :  09:49:07 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,
my data is stored in a txt-file like this:

1 1 3.4
1 2 34.3
1 3 34
2 1 33
2 2 343

The first 2 columns are my x and y-axes. The last column stores the actual value.
I'm trying to get a 3D bar graph from this data. I managed to convert the data to a matrix:

string path$ = "C:\";
	findfiles ext:=test.dat;
	impASC;
	wks.col3.type=6;
	worksheet -s 3;
	mat.wksname$ = %H;
	mat.xcol = 1;
	mat.ycol = 2;
	mat.zcol = 3;
	//Create a new matrix
	win -t mat;
	mat.matname$ = %H;
	//Convert the XYZ data to a matrix
	mat.xyz2m();


Is this right? And how do I get a 3d bar plot from this? I really read quite a lot about plotting but I found nothing about that.

Can you help me?

Moebius

larry_lan

China
Posts

Posted - 08/09/2010 :  09:55:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
We suggest you to upgrade your Origin to 8 or later. Then it will be easily to convert your worksheet data into matrix by the xyz_sparse X-Function.

Thanks
Larry
Go to Top of Page

Mo3bius

5 Posts

Posted - 08/09/2010 :  10:03:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I' using Origin 8. I just didn't know this function.

I tried now this:
string path$ = "C:\";
	findfiles ext:=test.dat;
	impASC;
	xyz_sparse iz:=Col(3) rows:=20 cols:=20


(My matrix has a x-range from 0 to 19 and a y-range from 0 to 19.)


When I enter this code, a new matrix is build, but there a no values in it. What am I doing wrong?

Moebius
Go to Top of Page

larry_lan

China
Posts

Posted - 08/09/2010 :  10:49:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
How about do that in GUI?

Do you mean you want to output an 20 by 20 matrix? The output matrix dimensions and matrix X/Y values are two differnt things. Maybe you can try this for your data

xyz_sparse iz:=3 rows:=21 cols:=21

Thanks
Larry
Go to Top of Page

Mo3bius

5 Posts

Posted - 08/10/2010 :  04:03:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If I use the GUI everything works fine. The problem is, that I have to import data from the same file about 20 times a day.

I tried this:

xyz_sparse iz:=3 rows:=21 cols:=21


(also with 20/20)

It didn't work. :(

I found a file in the samples which looks quite the same like my data:

\Samples\Matrix Conversion and Gridding\3D XYZ.dat

I just want to transform that data into a matrix. That is so easy in GUI, it has to be possible in Labtalk too?

Moebius
Go to Top of Page

Mo3bius

5 Posts

Posted - 08/10/2010 :  04:19:24 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Ok,
I found my first error. The last column with the actual values is wrongly recognized as text and not as Numeric!

Does anyone know how I import that proper?

Moebius
Go to Top of Page

Mo3bius

5 Posts

Posted - 08/10/2010 :  05:08:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It took some time, but here is the final solution:

string path$ = "C:\";
	findfiles ext:=test.dat;
	impASC;
	wks.col3.type=6;	
	wks.col3.format = 1;
	worksheet -s 3;
	xyz_sparse iz:=3 rows:=20 cols:=20;
	worksheet -p 242 3Dbars;
	speedmode sm:=off;


This maybe help someone.

Moebius

Edited by - Mo3bius on 08/10/2010 05:08:34 AM
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