ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to segment a 1D array into a 2D array?

Solved!
Go to solution
Here's a real dataset in a spreadsheet file.
0 Kudos
Message 11 of 18
(1,747 Views)

the data seems to be both comma seperated and space (or tab) seperated.  The data seems to be two intigers seperated by a comma and then a tab and the chance for two more intigers or two zeros.  They almost look like coordinate pairs. 

 

 

0 Kudos
Message 12 of 18
(1,743 Views)

No, the comma is the decimal sperator in certain countries. We just need to read the with the correct localization settings. 🙂

 

So:  11,825 == 11.825

Message 13 of 18
(1,738 Views)

Ahhhh!...forgot for a moment.

 

Thanks.

 

Well, then, I am confused...

 

Is the rule

read data, if zero skip...if nonzero add to array row until next zero is encountered?

 

Hummer1

 

"When flying, a number accurately presenting the average granite content of a cloud is of little use."

0 Kudos
Message 14 of 18
(1,736 Views)

"Is the rule

read data, if zero skip...if nonzero add to array row until next zero is encountered?"

 

Yes. 🙂

0 Kudos
Message 15 of 18
(1,713 Views)

altenbach wrote:

We just need to read the with the correct localization settings. 🙂


 

Or, open the file with Word or Notepad and replace the "," by a "." 🙂

Message 16 of 18
(1,706 Views)
Solution
Accepted by topic author gisti87

Try something like this (LabVIEW 8.5):

 

 

Seems to work with most typical inputs and can probably be simplified further.

(Still needs a few tweaks, e.g. if the array contains only one element and that element is zero the output is a 2D array with a zero instead of an empty array).

Message Edited by altenbach on 11-17-2009 11:52 PM
Download All
Message 17 of 18
(1,695 Views)
That's a working solution, thank you!
0 Kudos
Message 18 of 18
(1,683 Views)