Mercurial > octave-nkf
comparison src/ls-mat-ascii.cc @ 5951:b2167e370f82
[project @ 2006-08-22 05:13:42 by jwe]
author | jwe |
---|---|
date | Tue, 22 Aug 2006 05:13:42 +0000 |
parents | 5a3a716c257d |
children | b39ecdddd77b |
comparison
equal
deleted
inserted
replaced
5950:2b2e5a937c59 | 5951:b2167e370f82 |
---|---|
332 save_mat_ascii_data (std::ostream& os, const octave_value& val, | 332 save_mat_ascii_data (std::ostream& os, const octave_value& val, |
333 int precision) | 333 int precision) |
334 { | 334 { |
335 bool success = true; | 335 bool success = true; |
336 | 336 |
337 long old_precision = os.precision (); | |
338 os.precision (precision); | |
339 | |
340 if (val.is_complex_type ()) | 337 if (val.is_complex_type ()) |
341 warning ("save: omitting imaginary part for ASCII file"); | 338 warning ("save: omitting imaginary part for ASCII file"); |
342 | 339 |
343 Matrix m = val.matrix_value (true); | 340 Matrix m = val.matrix_value (true); |
344 | 341 |
347 success = false; | 344 success = false; |
348 | 345 |
349 error_state = 0; | 346 error_state = 0; |
350 } | 347 } |
351 else | 348 else |
352 os << m; | 349 { |
353 | 350 long old_precision = os.precision (); |
354 os.precision (old_precision); | 351 |
352 os.precision (precision); | |
353 | |
354 std::ios::fmtflags oflags | |
355 = os.flags (static_cast<std::ios::fmtflags> (std::ios::scientific)); | |
356 | |
357 os << m; | |
358 | |
359 os.flags (oflags); | |
360 | |
361 os.precision (old_precision); | |
362 } | |
355 | 363 |
356 return (os && success); | 364 return (os && success); |
357 } | 365 } |
358 | 366 |
359 /* | 367 /* |