LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot in Mathematica

Solved!
Go to solution

hello,

 

 

  1. I was thinking of a way to run a Mathematica code from labview. The code is a simple ListPlot or Plot3d in mathematica. 
  2. Right now , I can open a mathematica notebook via LV ( using System Exec.vi ) and then have to insert the file path ( as shown in the code snippet below ) and then execute it. 
  3. What I want - Since I already know the path where the file is saved in LV, I can put that file path automatically to this code and just by click of a button , lets call " Plot in Mathematica " . I can get a plot.

 

Is there a way to do this. 

 

test = Import["C:\\Users\\Raman\\Desktop\\XXXXXXX.csv"];
Z = Partition[Map[Last, test], Sqrt[Length[test]]]; ListDensityPlot[Z,
  PlotRange -> All, ColorFunction -> GrayLevel, Mesh -> False, 
 PlotRange -> All]

 Best,

 

Abhi

Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
0 Kudos
Message 1 of 2
(2,632 Views)
Solution
Accepted by topic author abikutn

Unless you can pass in parameters when you launch your workbook such that that they allow you to input the lines of code and run the code, you won’t be able to do what you are trying to do with System Exec.Basically, if Mathematica gives you the ability to do what you want in command prompt then chances are you will be able to do that with System Exec.

 

Some programs have an ActiveX server (Ex. Word and Excel). Using the properties and methods available with the server you can make changes to the document. If Mathematica has an ActiveX sever you might be able use it to accomplish what you are trying to do. However, you will have to know which methods and properties are available and how to use them.

 

There is a third party software which allows you to use Matemataica from within LabVIEW. For more information, take a look at this.  

 

Arham

Arham H
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,560 Views)