キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

How to change csv file to dat file

解決済み
解決策を見る

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 件の賞賛
メッセージ11/16
2,085件の閲覧回数

@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.



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 件の賞賛
メッセージ12/16
2,071件の閲覧回数

 

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 件の賞賛
メッセージ13/16
2,059件の閲覧回数

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.



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 件の賞賛
メッセージ14/16
2,051件の閲覧回数

@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 件の賞賛
メッセージ15/16
2,047件の閲覧回数
解決策
受理者 NurHidayah

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

0 件の賞賛
メッセージ16/16
2,022件の閲覧回数