LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Copy and paste array between instances?

I have A.vi and B.vi. The last time I used these was in 8.6. I now have to use them on a machine with 8.2, but A.vi does not work in 8.2 without a bunch of tweaking, so I made it A.exe.

 

A.exe builds and recalls files that contain arrays of DaqMx channels. I create long lists of channels once, and then since they are stored to a file, do not have to create them again. In the past, instead of adding code to B.vi to call the file, I would just open the file I wanted with A.vi, then copy the data from the array of channels, and paste it into the front panel of B.vi before pressing run.

 

I cannot do this now. Is it because A is an EXE so the two are in different Application instances? I have not tried making B an EXE (nor do I want to), but I think it wouldn't matter because they would still be in different instances?

0 Kudos
Message 1 of 7
(5,217 Views)

Deskpilot-

When you build an EXE, it no longer runs in the LabVIEW environment.  It is compiled into code and simply executes that all by itself like a completely separate program.  This is probably the reason you are seeing this behavior.  You can create your file and simply read the file from your B.vi if that will work for your application.

Regards,

Mike S
NI AE
Message 2 of 7
(5,188 Views)

I guess I was incorrect to say that the EXE was running in an application instance. I still don't understand why the copy and paste doesn't work. All programs on the computer share the clipboard, right? I can copy the data from the front panel array of channels in the EXE, and paste it to word as a picture. Why can't I paste it into the VI as array data? Is this a bug or expected behavior?

 

I'm considering altering B.vi, but it is not my code and it is not an easy one to follow.

0 Kudos
Message 3 of 7
(5,164 Views)

Deskpilot,

 

To clarify, in the original scenario with A.vi and B.vi, were you copying the array indicator/control object from B.vi pasting it into A.vi and wiring it appropriately on the block diagram? Or, were you copying the contents of the array control/indicator from B.vi pasting them appropriately into the A.vi array control? 

 

I believe there would be a better way to enable programmatic DAQmx Channel configuration in A.exe using File I/O primitives, and the 'Unflatten Channel String' function native to DAQmx. When copying DAQmx channel information, the channels will be specific to the version of LabVIEW the objects were created in. This case presents the complexity that the EXE is being hosted in the 8.6 Run-Time environment, and you are attempting to pass channel data created in the 8.2 development system. Can you copy other data types? (For example, a standard string, or numeric double) 

 

Thank you for your time, I look forward to your response.

 

Regards, 

Patrick Corcoran
Application Engineering Specialist | Control
National Instruments

0 Kudos
Message 4 of 7
(5,137 Views)

I'm not sure what you mean by a couple of your comments, but let me try to clarify the situation. 

 

Yes, I can add code to B to have it read from the same configuration file that A does, but I don't want to and that wasn't my question.   

 

Program A is my entire data acquisition program. Part of this program is a setup window that allows for the selection of DaqMx channels that have been created in MAX. That channel list, along with dozens of other things are stored as a cluster in a binary file that can be retrieved later. When it is retrieved, I read it into an indicator that is off the main front panel. This way I can scroll over to to it if I want to verify that I've loaded the correct configuration file. This whole thing works great.

 

About a year ago, along comes a test that requires strain gauges that need calibrating. A colleague wrote a VI to calibrate fifty or so strain gauges in a timely manner. Since I already have the list of channels that need calibrated displayed on my front panel, I call my main acquisition program so that the channels are displayed in the array indicator, right click on the array, and choose copy data. I then run B.vi, when I get to his screen that requires me to select 50 channels again, I right click on his array control and choose paste data. These are arrays of DaqMx global virtual channels.

 

 

Also, just so I don't leave anything out, the acquisition program (A) has been updated and so is running on a LV2009 runtime engine while B was opened in 8.6 and saved for previous version to to run in the 8.2 LabVIEW environment.

 

Finally, I cannot copy any data types from the EXE. I just tried to copy a string and paste it to a string in a LV2009 VI and it pastes as a picture.

 

I have not run any patches or updates on my installation of 2009, not sure if this would make a difference?

0 Kudos
Message 5 of 7
(5,123 Views)

Are both the VI and the EXE running at the time you are copying and pasting this information? I recreated a simplified application; such that, I could select information in numeric or string controls on an EXE front panel copy it; and subsequently, paste the data correctly in a control on the front panel of a LabVIEW VI. Could you post screenshots illustrating exactly what data is being copied? The behavior you describe seems to indicate you are copying the entire control or indicator object, and attempting to paste it in a cross-platform manner? 

 

In addition, this program seems like it could benefit from programmatic definitions of DAQmx channels, this example describes methods of leveraging the DAQmx driver functions to define a set of physical channels for a task configuration. 

 

Please post back any additional questions, or information regarding the system.

 

Thank You, 

Patrick Corcoran
Application Engineering Specialist | Control
National Instruments

0 Kudos
Message 6 of 7
(5,104 Views)

You recreated numeric and string controls in an EXE. I agree that you can swipe these, CTRL C, and then CTRL V in to a VI. If I replace the CTRL C action with a Right Click> copy data, I get a picture in the VI.

 

I can go to a numeric or text control or indicator within my EXE, right click, copy data, then paste that into another control within my EXE. If I then immediately go to a control in the VI, the Right Click>paste data option is greyed out and doing CTRL V drops a picture of the controlon the front panel. I did not select the control when I copied, I only highlighted the data inside the control.

 

CTRL C or CTRL V is never an option when operating on array controls. I do not want to copy and paste individual lines of the array, I want the whole array data. This is done by right clicking on the numeric within the array index display and choosing copy data. In an EXE, this is your first option. In a VI while running, this is the third option. In a VI while not running, this is under data operations.

 

I tried every combination of running and not running, and took screenshots, but it is hard to see exaclty what action I am performing.

 

0 Kudos
Message 7 of 7
(5,085 Views)