From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help Importing into Labview for use as a matrix in Matlab script node

Hello,

I was hoping someone could help me out with a labview / Matlab script
problem. I'm using Labview to allow someone to specify which file to
load, inparticular a Labview measurement file appears to load my text
file in a spreadsheet format(which is what I want, see ex. text file
code below), then I want to use the loaded file as an input into my
Matlab script box as a matrix for use in the Matlab code. Can I do
this?

This is my text file.

1004,30,0,1.43
1003,304,0,1.34
etc

So the Labview measurement file seems to space everything out into a
matrix format like I want, but I can't tell if there are any errors in
the matlab script or whatnot. I'm using events to wait for the user
input. The matlab script has a variable named DATA as the input
variable in matrix format, then I just connected this variable to the
output from the measurement load file box, but it doesn't work,

thanks for any help.

P.S. I also am having a problem with my event structures. I have an
event, that is inside a while loop like the code suggests, but when I
run the program the button I click gives me the results I want, but if
I click it a second time the program freezes or doesn't respond...

0 Kudos
Message 1 of 4
(2,562 Views)

I think the "Spreadsheet String to Array" function will serve your purposes here. You need to convert your comma delimited file into a 2D array. The Spreadsheet String to Array function does this for you. See the attached example.

 

As for for your second question about events, try enabling highlight execution (the lightbulb next to the run button on the block diagram) and see what your program is doing step by step. This is the quickest way to figure out where your program is getting stuck.

 

Post to let us know if you have other questions

 

Chris C

 

0 Kudos
Message 2 of 4
(2,554 Views)
Hey Chris,

Thank you very much for your help. However I have labview 7.0 and
unable to open 8.0(the 2dstring vi) in my version of labview. Is there
another way I can see how to do this?

Thank you,

John

0 Kudos
Message 3 of 4
(2,546 Views)
Hey John,
I've attached a screen shot of the block diagram. Post to let me know if you have other questions.
 
Chris C

Message Edited by Chris_C. on 05-22-2006 10:48 AM

0 Kudos
Message 4 of 4
(2,539 Views)