LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D array to 1D array without knowing the total row.

Solved!
Go to solution

Roziela,

 

If you would like to convert a 2D array to a 1D array, you can use the Reshape Array.vi found on the array pallet.  When you use this vi to make the conversion, it will append each row (0 through n) into one 1D array.  I attached a picture and a vi to try.

 

Cheers 

-cb

Download All
0 Kudos
Message 11 of 15
(1,079 Views)
Solution
Accepted by topic author Aleizor

Hi all,

 

Thanks for all the replies.

You guyz give me ideas and ways to do it.

I figured out what i need and i have attached it here, just to share.

 

Thank you all~ 

 

p/s: altenbach, you're good in simplifying code, any ideas on how to do it?  :smileywink:

0 Kudos
Message 12 of 15
(1,070 Views)

Genius!!!!!!

Best Regards,
-----------------------------------------------------------------------------------------------------------


0 Kudos
Message 13 of 15
(718 Views)

Aleizor wrote:

You guyz give me ideas and ways to do it.

p/s: altenbach, you're good in simplifying code, any ideas on how to do it?  :smileywink:


Yes, here's code that does exactly the same as your "mostrosity", using about 20% of the code. 😄

 

(note that everything except the code needed for the xy graph can be deleted. All stuff marked in red is not really needed)

 

 

 

 

 Some comments regarding your original code:

  • If you are autoindexing, you don't even need to know the number of rows.
  • The "array-to-cluster-unbundle dance" is just silly.  plain index array does the same thing. (See also)
  • Checking for an empty array as well as your case structure make no sense here.
  • What's the purpose of the 1500ms delay in the loop? Just to annoy us?
  • Your converted time stamp array indicator does not belong inside the loop, it never changes.
  • You don't even need to convert to a timestamp. It is sufficient if the graph axis is formatted as timestamp.
  • Your disabled code: If you want the elements in order, starting with the first, the indices don't need to be wired.
  • ...
Download All
0 Kudos
Message 14 of 15
(714 Views)

Also note that you only need an xy graph if the x values are not spaced equally. If they are spaced equally as in your example, a plain waveform graph is sufficient and all you need is set x0 and dx, simplifying the code even more.

0 Kudos
Message 15 of 15
(698 Views)