LabVIEW and MatLab interface

2 views (last 30 days)
Shreya
Shreya on 8 Oct 2014
I have a LabVIEW program which has a subVI (via Mathscript) which calls a MatLab program to read some files and perform some calculations. I want to make some changes in the program such that when a button is switched on in LabVIEW the MatLab code reads file (a)sameprice.csv and when it is off, it reads file (b)price.csv. How do I create such an interface between LabVIEW and MatLab?
The original MATLAB code snippet looks like:
Eprice_72per = xlsread('price.csv','D2 : D73')/1000;
[num,EpricePeriod1,raw] = xlsread('price.csv','A2:A73');
[num,EpricePeriod2,raw] = xlsread('price.csv','B2:B73');
But I want it to perform something like this:
%electricity price
if (Boolean_fromLabVIEW = true)
Eprice_72per = xlsread('sameprice.csv','D2 : D73')/1000;
[num,EpricePeriod1,raw] = xlsread('sameprice.csv','A2:A73');
[num,EpricePeriod2,raw] = xlsread('sameprice.csv','B2:B73');
else
Eprice_72per = xlsread('price.csv','D2 : D73')/1000;
[num,EpricePeriod1,raw] = xlsread('price.csv','A2:A73');
[num,EpricePeriod2,raw] = xlsread('price.csv','B2:B73');
The if statement is just to make you understand how I want the code to behave. In reality, I want to know how to read the status of the Boolean button from LabVIEW in order to decide which file (whether price.csv or sameprice.csv) to read.
The LabVIEW forum people directed me here.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!