From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Read in Labview from txt file (or mat file)

Solved!
Go to solution

Hi,  I have some data in Matlab, specifically a column vector. it is a series of numbers indicating the distance of an object like this:

    .......
    3.2886
    3.2886
    3.2464
    3.2464
    3.2464
    3.2464
    3.2464
   -1.0000
   -1.0000
    ..........

where the number -1 indicates the distance is unknown. By the way I have to bring these numbers in Labview.
First I saved these numbers as a txt file:

 

   1.6473000e+00
   1.6473000e+00
   1.6473000e+00
  -1.0000000e+00
  -1.0000000e+00
  -1.0000000e+00

and then I read it in Labview as a string:

Immagine.png

 

but I am not really convinced this is the best approach, how can I do?
I would like to have the same structure of an array in Labview as well

0 Kudos
Message 1 of 3
(2,641 Views)
Solution
Accepted by topic author micheleG_Unipd

Hi Michele,

 

use ReadFromSpreadsheetFile instead, it will give you an array of floats instead of a simple string!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,637 Views)

Thank you! It is so easy in this way: D

0 Kudos
Message 3 of 3
(2,628 Views)