Re: Writing formatted text files when column number of the ouput is uncertain?



My version is 6.5.1.

The code is running OK now even though I have an older version. Don't know what went wrong before. However, the matrix dimension got changed.

For example, if the dimension of the matrix is 5*9, when exporting it using dlmwrite function, it no longer appears as a 5*9 matrix in the output file. In your example, the 10*10 matrix became one single line in the output. Any way to keep the orginal dimension of matrix in the output?

Thanks,
Stephen

"us " <us@xxxxxxxxxxxxxxx> wrote in message <f8nlam$3tv$1@xxxxxxxxxxxxxxxxxx>...
stephen:
<SNIP version problem...

That's what HELP says
"dlmwrite(filename,M,delimiter,R,C) writes matrix A into an ASCII-format file, using delimiter to separate matrix elements...

bad news: you seem to have an older ML version(?)...

in r2007a it says:

DLMWRITE Write ASCII delimited file.
DLMWRITE('FILENAME',M) writes matrix M into
FILENAME using ',' as the delimiter to
separate matrix elements.
DLMWRITE('FILENAME',M,'DLM') writes matrix M into
FILENAME using the character DLM as the
delimiter.
<...>

furthermore, this works as expected

m=magic(10);
dlmwrite('foo.txt',m,'\t');

what version do you use?
what error do you get?

us

.



Relevant Pages

  • Re: Properly displaying items from hash
    ... The program extracts the values after the -> delimiter of both files ... CA FILENAME => AA_FILENAME ... How do I get the desired output without resorting to the 'double pop'? ... You could accomplish the same thing more simply with a hash slice: ...
    (perl.beginners)
  • RE: Export to CSV file problems
    ... ActiveWorkbook.SaveAs Filename:= _ ... (please remember to click yes if replies you receive are helpful to you) ... language of VBA and not the regional settings. ... I need to create a CSV file with ~ as the delimiter. ...
    (microsoft.public.excel.programming)
  • Re: Extract lines from files
    ... % Loop over each ... % Make a new filename ... newfilename = sprintf; ... % Write to a delimited file using a space as the delimiter ...
    (comp.soft-sys.matlab)
  • Re: manage blankspaces in filenames
    ... bad idea to assume that file names don't contain white spaces. ... delimiter" to use something which means something spacial like that in the ... filename is simply asking for trouble. ... Would you also put single quotes ...
    (alt.os.linux)