LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Import to array in IDE interface

When right-clicking on an array, in front panel or block diagram, there is a practical "Export" function, for copying the data to Excel or to clipboard. But I can't find an "import" function, to quickly paste data to an array, is it missing?

0 Kudos
Message 1 of 7
(3,287 Views)

Hey,

I understand where you are coming from but it would be a bit difficult to make sure the pasted data is in the right format.

If you want that functionality you quite easily use the read from speadsheet VI and wire it to a local variable of the array, that could be done at the start of the problem for example.

Read.png

 

Message 2 of 7
(3,262 Views)

Not sure if this helps or not but attached is a utility that I use to create array constants.

It can also be used in an application.

 

To use it:

  • Copy a column or row from an Excel file or Word table
  • Paste it into the running utility (MS Data - string control)
  • Click on the Convert button to see the results
  • You can edit the input string and re-convert if needed

In a program, you can use the output of the vi.

If you just want an array constant, stop the utility and drag the String Array to a block diagram.

 

steve

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 7
(3,245 Views)

Is this something you want to bring into a control or constant?  If so I've been using a QuickDrop plugin shown here.

 

http://forums.ni.com/t5/LabVIEW/QD-Shortcut-Paste-to-Array-Constant/m-p/1088366

 

With it I copy cells from Excel, or a Word table, then I mapped this to CTRL+O (default is CTRL+E) and it will create an array control or constant of the clipboard contents as a string or number.  

Message 4 of 7
(3,234 Views)

As stated by NIJimbo, there's no built-in function to accommodate this request.  But in general, it's not a very hard problem to resolve.  I like to use the "Spreadsheet String to Array" method to create a very simple translation from the clipboard (ascii) to an array I can manipulate.

 

spreadsheet_string_to_array_example.png

 

 

Good luck.

Ken

Message 5 of 7
(3,225 Views)

Hey, I know how to convert a string to array 🙂

The question is about the UI. The QuickDrop mentioned above isn't perfect but helps

0 Kudos
Message 6 of 7
(3,199 Views)

You could hijack the paste operation using an event structure and use a similar methodology to pull data from the clipboard into your control.  This example isn't perfect (as it's based on pasting into the value of the array index control), but it demonstrates how you could tweak the UI to behave how you'd like to perform the paste operation.

 

CTRL+V_to_Array_ctl.png

P.S. Take a look at the attached VI to get the snippet without all the broken wires and/or refnum shown above.

 

You could do similarly with a drag-and-drop and/or right-mouse-click action on this control. Or even just implement a paste button next to the control for ease of use.

 

Good luck.

Ken

0 Kudos
Message 7 of 7
(3,184 Views)