LabVIEW Communications System Design Suite

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read a file that contains a matrix !!

Solved!
Go to solution

Hello everyone,

 

I have a file that I have saved from matlab using this command : SAVE filename X -ascii -double -tabs.

but I don't know how to read it and extract its data to plot in intensity graph.

 

Any help please.

 

Best Regards,

 

Emna

 

0 Kudos
Message 1 of 12
(6,163 Views)

Hi Emna,

 

you have to connect a double constant to the read VI, I corrected your VI and you can find it in the attachement. Also please do not open the same request twice:

 

read from binary file - Discussion Forums - National Instruments
http://forums.ni.com/t5/LabVIEW-Communications-System/read-from-binary-file/m-p/3317541#M550

 

Best Regards,

Gregor

Message 2 of 12
(6,146 Views)

Hi Sir,

 

Thank you for helping me.I am sorry for repeating the question.I was just searching for an answer.

 

But if you see the values in the file 'file2' , they don't correspond to the values in the graph.Can I know the cause of this problem ??

 

Best,

 

Emna.

0 Kudos
Message 3 of 12
(6,143 Views)

Hi,

 

you have to be more specific, what values would you expect, what do you mean, the values dont correspondent?

 

Could you create a small test file with 10 Values in Matlab and then read that file in LabVIEW for a test?

0 Kudos
Message 4 of 12
(6,139 Views)

Hi,

 

the values in the file 2 are in the range of 1e+05   but what is plotted in labview is in the range of E179.

Doesn't seem logic right ?

0 Kudos
Message 5 of 12
(6,137 Views)

One other problem with the VI 'write to binary file' is that the number of samples of data as input to that VI is not the number of samples in the file!!

You will find attached my labview program ( please take a look at probe 2 ) and the txt files that I have extracted.

when I execute my text file in matlab I find that the number of samples of my output X is much bigger than the one in labview.

 

Any help please.

Download All
0 Kudos
Message 6 of 12
(6,129 Views)

Hi emnajaoua,

 

apparently this is not so simple. Since you are reading a Text File, with a specific configuration (Tabstop Delimiter, Dot Separator) you will have to do some adjustments. First of all you should be aware, that it depends on your location, whitch separator is used for decimals. In the US for example a dot is the regular separator (5.875) in Germany its the Comma (0,485). Natively LabVIEW uses the Separator that is defined by the local OS. 

The next thing you should think about is your file structure, what is your Delimiter (Tabstop, Comma for CVS, etc)? So in the worst case you have a Tabstop File with dot Separated values on a german OS. Then you have to read the file as a String File, replace all dots with a comma and then transform it to a double array, which you can display.

 

I would recommend to define a good file structure in Matlab, so that the file that you export is easy to read in with LabVIEW. Start wit small file (10 simple Values) and test a little bit until you get valid  values.

 

Best Regards,

 

Gregor

Message 7 of 12
(6,105 Views)

Hello,

 

I have managed to find a way to convert my input file(via excel) to matlab but now in the phase of plotting the data from matlab to labview I have as a file (the attached one).So is labview capable of reading it or processing it ??

 

Best Regards,

 

Emna Jaoua

0 Kudos
Message 8 of 12
(6,083 Views)

I am sorry! I couldn't attach the file it is too heavy.So here a capture from it :2.PNG

0 Kudos
Message 9 of 12
(6,076 Views)

Hi,

 

I have this format of file from matlab and I want to read it in labview through a simple program attached here.

The values that I have got seems illogic at all.

Any help please?

Download All
0 Kudos
Message 10 of 12
(6,056 Views)