LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview-Octave/GNUPlot Inegration

Hello, forum! I'm working on a little project to take images I've acquired using some LabVIEW code and automatically import them into GNU Octave (similar to MATLAB) and turn them into a 3D image "stack" an added bonus would bethe ability to return the stack to LabVIEW and view it in the front panel.

 

I know that it's possible to interact with Matlab using ActiveX, but as far as I understand it, that feature's missing from Octave, so what I've been working with so far is invoking Octave from the command line (using Sys Exec) end sending it commands directly. My code is attached; OctaveStacker.vi is the main. For some situations the interface works perfectly; for example in simple cases of affecting variables, arithmetic and so forth.

 

If you use the text in "script.m" instead of the output from the subVI and remove the semi-colons (verbose), you can see the results appearing as expected in the output box on the front panel. However, when the script gets to the "plot" command, which should cause Octave to open GNUPlot and plot x against y in a new figure window, nothing happens. Presumably the image commands in my other script would have similar problems. If I run my main VI using the two example pictures in the archive, however, I get no response at all except being dumped back at the working directory Windows shell in the output box. If anyone has any expertise in this area, I'd be much obliged for any help. 

---------------------------------------------------------------------
LabVIEW 2013, Windows 7

He who asks the question is a fool for five minutes; he who does not ask the question remains a fool forever.
0 Kudos
Message 1 of 5
(5,294 Views)

Hi MattA1,

 

I've read through your VI and I'm currently downloading the Windows version of Octave so that I'll be able to play around with your code; however it may take some time to get up to speed because the String concatenation VIs are constructed in a way that references file locations on your computer.

 

For code modularity, it's great to make use of the Path based functions to reference to files stored in a local directory to the VI. By using the Current VI's Path VI in conjunction with the Strip Path and Build Path VIs, you'd be able to reference VIs files regardless of the computer you're connected to. This would be good for if you ever want to transport your VIs to other computers; it'd be especially useful in this debugging case! Smiley Very Happy

 

Firstly, I believe that issues may be occuring because of the striking difference between "script.m" and "OctaveStacker.m"; mostly because OctaveStacker contains function calls which combine the functionality of the Windows Command Prompt and calculation functions, which may be causing some of the confusion. It'd be interesting to see how the .m file reacts when they're missing and called via LabVIEW.

 

However, for now, I just need to change this VI so that it'll match my computer. But I'd suggest that it may be worth trying removing the directory transitions and just using the folders locally and seeing whether this makes a difference. In terms of the String concatenation SubVIs you use such as the OctaveStackingScript VI, I recommend ensuring that the Strings you build are compatible in both of these instances when calling different kinds of Scripts.

 

Do I have a good idea of your problem? For now I'll keep working on trying to getting all of the references working on my computer. (Not to mention installing Octave!)

 

Regards, 


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 2 of 5
(5,203 Views)

 

Hi MattA1, I've generated the code below to try and invoke the plot method as you suggested.  

 

Octave Call.png

 

As interaction with Octave can be affirmed through the return of the Octave Output; in terms of the numeric based outputs from calculations, I believe some incompatibility must exist when Octave is called in this way. My assumption is that the plot function cannot be used as a parameter in a call and this is why it cannot be seen when invoked, although no errors are thrown due to it being a valid function call. I'll try to research more into this; did you manage to get anything working?

 


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 3 of 5
(5,182 Views)

Hi Matt,

 

I will need to do something similar in regards to using Octave scripts in LV.  Did your integration work well?  Looks like SciLab can be used as well.

 

Rich

0 Kudos
Message 4 of 5
(4,946 Views)

Hi thank you for your answers and sorry about my not having replied.

 

I did not try your solutions, as my project finished, and I then moved onto other, non-LabView based projects. When the opportunity arises, I will test these and report back.

---------------------------------------------------------------------
LabVIEW 2013, Windows 7

He who asks the question is a fool for five minutes; he who does not ask the question remains a fool forever.
0 Kudos
Message 5 of 5
(4,773 Views)