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
 Convert XYZ Data to Matrix and plot 3D Bars

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
Mo3bius Posted - 08/09/2010 : 09:49:07 AM
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
6   L A T E S T    R E P L I E S    (Newest First)
Mo3bius Posted - 08/10/2010 : 05:08:13 AM
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
Mo3bius Posted - 08/10/2010 : 04:19:24 AM
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
Mo3bius Posted - 08/10/2010 : 04:03:48 AM
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
larry_lan Posted - 08/09/2010 : 10:49:41 AM
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
Mo3bius Posted - 08/09/2010 : 10:03:40 AM
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
larry_lan Posted - 08/09/2010 : 09:55:28 AM
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

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