07-04-2016 08:36 AM
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
Solved! Go to Solution.
07-05-2016 01:12 AM
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
07-05-2016 01:43 AM - edited 07-05-2016 01:46 AM
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.
07-05-2016 02:31 AM
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?
07-05-2016 02:46 AM
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 ?
07-05-2016 04:33 AM
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.
07-07-2016 01:56 AM
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
07-07-2016 08:27 AM
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
07-07-2016 11:10 AM
I am sorry! I couldn't attach the file it is too heavy.So here a capture from it :
07-08-2016 10:27 AM
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?