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
 Forum for Origin C
 Splitting vector rowwise

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
couturier Posted - 12/07/2021 : 11:04:42 AM
Origin Ver. and Service Release (Select Help-->About Origin): 2022
Operating System: win10

I have a xml file in which I read a string value that actually represents many vectors
string looks like this:
"0,19,126,163,29,0,0,0,0,0,
0,0,0,209,0,0,35,148,159,264,
468,66,421,706,639,506,399,716,604,382,
535,414,304,563,493,223,250,6,53,0,
0,0,81,0,0,0,0,0,0,0,
....
and so on"

I can put it into a vector<string> with GetTokens(), but then I need to further extract each element into separate vectors.
This is doable with a loop but this is way too slow (I have more than 20000 lines)

Is there any method that could speed things up ?
This string has the same structure than an ascii file, would it be possible to use ImportASCIIFile(), with a string instead of a file ?

Thanks
3   L A T E S T    R E P L I E S    (Newest First)
minimax Posted - 01/19/2022 : 01:36:35 AM
Hi,

In 2022b Beta version, we added a function SetByText() for matrixbase.

void st(string str="1,2,3\r\n2,3,4\r\n7,8,9\r\n")
	{
		matrix<int> mm;
		mm.SetByText(str);
		Worksheet wks = Project.ActiveLayer();
		mm.CopyTo(wks);//default will transpose
	}


People who is interested may try.
couturier Posted - 12/08/2021 : 02:38:57 AM
thanks a lot
cpyang Posted - 12/07/2021 : 2:14:20 PM
We can easily add this to matrixbase, I added

https://originlab.jira.com/browse/ORG-24624

CP

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