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
 importing data in matrix

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
elena_loginova Posted - 12/09/2009 : 9:56:42 PM
Origin Pro 8 SR 6, Windows XP

Hi,

I need help in importing one column into the matrix with dimensions n x m. Could anybody please help me with a script or with a one-time procedure? I cannot find this information anywhere. Thank you in advance. Elena.
2   L A T E S T    R E P L I E S    (Newest First)
elena_loginova Posted - 12/11/2009 : 11:43:02 PM
Thank you, Larry! It works! I appreciate your fast response.
larry_lan Posted - 12/10/2009 : 10:32:23 AM
Hi Elena:

The following script is a simple example to put data from one column into a n by m matrix.

// Supposed source data in column 1 of sheet1, book1
// and target matrix is the first matrix in mbook1, msheet1
range rw = [book1]sheet1!col(1);
range rm = [mbook1]msheet1!mat(1);

n = 3; // matrix row
m = 2; // matrix column

for(int ii = 1; ii <= n; ii++)
{
	for(int jj = 1; jj <= m; jj++)
	{
		rm[ii, jj] = rw[(ii-1)*m + jj];
	}
}

Please change the script as you need. In the script, we use ranges to access different Origin objects. Maybe you can start reading from the range notation charpter in our LabTalk Guide to know how to write such scripts?

Thanks
Larry

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