04-18-2013 11:38 AM
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.
04-18-2013 12:29 PM
@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.
04-18-2013 01:52 PM
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.
04-18-2013 02:07 PM
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.
04-18-2013 02:13 PM
@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.
04-22-2013 07:20 AM
Nur, as the others mentioned, try reading your MAT file, it should read without any issues.