LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

QD Shortcut - Paste to Array Constant

They have done it again, another conversation in the Idea Exchange has asked to reach into my junk drawer of QuickDrop shortcuts.  In this idea, Ravens Fan mentioned that he would like to create a set of cells in Excel where it is easy to autoincrement, etc., and then copy/paste into an array constant.  It so happens that after doing this once a while back, I decided it was right up Quick Drop's alley.  Here is the shortcut, once again unzip the files and put them in the directory

 

[LabVIEW 2009]\resource\dialog\QuickDrop\plugins

 

Create some cells in Excel (or other similar program), select and copy to the clipboard.  (Any tab delimited data will work).  On the FP Ctrl-Space Ctrl-e creates a control with the data in numeric form (simple check to decide DBL or I32).  Ctrl-Space Ctrl-E (shift+e) creates a string control.  Similar commands for the BD to create array constants (numbers or string).  Single rows or columns become 1D arrays, otherwise you get 2D array controls/constants.  Change the letter by renaming e.vi if you'd like.  I chose e for Excel since X was taken along with s for spreadsheet and a for array.

 

I use some Mouse VIs so this probably is not Mac friendly, if you don't mind the arrays getting dropped in never-never-land then you can remove the mouse gymnastics.  (GREATLY simplifies the VI).  Not all corner cases are covered, but I use this one quite a lot so maybe a few of my clicks can save a few others down the road. 

 

I should add this to the relevant pages in the Quick Drop Enthusiasts Community page when I get a chance.   It is not quite a high-traffic site yet, but it is one of my favorites.

 

 

Message 1 of 11
(5,362 Views)

Darin-

 

Iv'e been using the QD A to swap in arrays for a few weeks.  Love it!  but I just have one minor issue.

 

Oh No.png

Unfortunately the QD disconnects the wire from the replaced object.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 11
(5,251 Views)

Glad you like it, one of my faves.  I have been meaning to fix that little issue (95% of the time I use this upon creation).  The code is mostly complete, it just turned into spaghetti and stretched a bit horizontally.  I'll test, clean up and post an update.

 

(This probably belongs in my QD A thread)

0 Kudos
Message 3 of 11
(5,240 Views)

I have seemed to notice a number of users wishing they could import data from the clipboard or a text file into a LV array.  I have been happily doing this for a while now so I thought I would post my updated QD shortcut.  It is still LV9 style since that is what I use most often.  Just plop these guys into the plugins folder.  You can remove paste number and paste string SubVIs if you installed the old version, my new naming conventions include the shortcut letters in the subVI names.

 

New behavior for E shortcut:

 

Select an existing 1D or 2D array Control/Indicator (FP) or Constant (BD) if you want (one will be created if you do not select one)

Ctrl-Space Ctrl-e :Imports delimited data (tab, comma, space) from the clipboard into the array

Ctrl-Space Ctrl-E :Imports data from a selected file into the array

 

I typically use this for numbers so importing strings is hit-or-miss, tab-delimited should be ok.  You will have to create and select a string array before invoking the shortcut now since I use the shift key for other purposes now.

0 Kudos
Message 4 of 11
(4,497 Views)

If you are a right-clicker as I often am, here is a RCF shortcut which I hope works for LV8.6+

0 Kudos
Message 5 of 11
(4,496 Views)

I'm looking at the part where you substitute Tabs for multiple repeated whitespaces.  Is that an attempt to be compatible with some specific thing Excel might do? Or were you just trying to handle as many possible input formats as possible?  I ask because it looks like it was done mindfully, but it breaks in some fairly common usecases, like: 1) there are tab delimited cells with spaces in some of the cells and 2) when there are empty cells.  I'm more than happy to fix it myself, but it has that smell of Excel doing something weird that I'm not expecting, so I figured I'd ask you first.

0 Kudos
Message 6 of 11
(3,289 Views)

For my primary use cases of grabbing numeric data from forum posts or text files I found that it was common to have multiple delimiters (usually spaces) and that it was not uncommon for there to be inconsistencies in the number of spaces.  This cleaned up most of those cases.

 

I could see changing it in the case of text data.

0 Kudos
Message 7 of 11
(3,281 Views)

Hello, what is the above .vip supposed to do? I've installed it with VIPM and nothing seems to have changed in the interface (LabVIEW 2011).

0 Kudos
Message 8 of 11
(2,607 Views)

To use the .vip, you'll have to follow a couple of steps.

First, go to Tools, JKI Right-Click Framework, and then click Start.

If you go to options instead, it is possible to have it auto start with LabVIEW.

After that, you'll need to drag a box around the array you are pasting to, and then hold the Left Control + 1 keys to activate the right click framework.

Then, you'll be able to right click the array and paste in the data!

 

Hope that helps,

Casey G.
0 Kudos
Message 9 of 11
(2,590 Views)

Yeah the JKI right click framework was a useful at its time and the only way to really augment the right click menus in 2009.  But starting in 2015 NI has an official way to do custom right click plugins which generally works better.  As a result the JKI method gets less attention and support and may not work in newer versions of LabVIEW.

0 Kudos
Message 10 of 11
(2,583 Views)