LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change csv file to dat file

Solved!
Go to solution

The format is this from the matlab documentation:

 

The following remarks apply to loading all ASCII files, even when you do not include the -ascii keyword, but load a file with an extension other than .mat:

  • The file must contain a rectangular table of numbers, with an equal number of elements in each row. The file delimiter (the character between elements in each row) can be a blank, comma, semicolon, or tab character. The file can contain MATLAB comments (lines that begin with a percent sign, %).

  • MATLAB returns the data as a single two-dimensional array of type double. The number of rows in the array is equal to the number of lines in the file. The number of columns is equal to the number of values on a line.

  • If you do not specify an output for the load function, MATLAB creates a variable named after the loaded file (minus any file extension). For example, the command

     

     

    I think you can do strings with it also, but it requires undocumented stuff with the comment lines. 

0 Kudos
Message 11 of 16
(1,388 Views)

@ngarneski wrote:

The format is this from the matlab documentation:

 

The following remarks apply to loading all ASCII files, even when you do not include the -ascii keyword, but load a file with an extension other than .mat:

  • The file must contain a rectangular table of numbers, with an equal number of elements in each row. The file delimiter (the character between elements in each row) can be a blank, comma, semicolon, or tab character. The file can contain MATLAB comments (lines that begin with a percent sign, %).

  • MATLAB returns the data as a single two-dimensional array of type double. The number of rows in the array is equal to the number of lines in the file. The number of columns is equal to the number of values on a line.

  • If you do not specify an output for the load function, MATLAB creates a variable named after the loaded file (minus any file extension). For example, the command

     

     

    I think you can do strings with it also, but it requires undocumented stuff with the comment lines. 


If that's the case, I don't see a reason to change the file.  It looks like MATLAB will read your CSV file just fine.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 12 of 16
(1,374 Views)

 

This is my block diagram. The data is in csv file. So, i want save data in dat file. How the process?

 

Need your help.

 

Thank you. 

 

0 Kudos
Message 13 of 16
(1,363 Views)

Again, what exactly are you trying to do?  Why are you trying to change the data format?  If you just want to read your file in MATLAB, it looks like it will already read comman delimited files, therefore you don't need to do any conversions.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 14 of 16
(1,355 Views)

@crossrulz wrote:

@ngarneski wrote:

The format is this from the matlab documentation:

 

The following remarks apply to loading all ASCII files, even when you do not include the -ascii keyword, but load a file with an extension other than .mat:

  • The file must contain a rectangular table of numbers, with an equal number of elements in each row. The file delimiter (the character between elements in each row) can be a blank, comma, semicolon, or tab character. The file can contain MATLAB comments (lines that begin with a percent sign, %).

  • MATLAB returns the data as a single two-dimensional array of type double. The number of rows in the array is equal to the number of lines in the file. The number of columns is equal to the number of values on a line.

  • If you do not specify an output for the load function, MATLAB creates a variable named after the loaded file (minus any file extension). For example, the command

     

     

    I think you can do strings with it also, but it requires undocumented stuff with the comment lines. 


If that's the case, I don't see a reason to change the file.  It looks like MATLAB will read your CSV file just fine.


Yeah, when I wrote my response originally I didnt realise that matlab can do anything other then files seperated by spaces or tabs. The only thing it wont read most likely would be a csv file with text mixed with numbers. In that case the MATLAB "csvread" function would probably work. 

0 Kudos
Message 15 of 16
(1,351 Views)
Solution
Accepted by topic author NurHidayah

Nur, as the others mentioned, try reading your MAT file, it should read without any issues.

0 Kudos
Message 16 of 16
(1,326 Views)