Mercurial > octave
comparison src/ov-cell.cc @ 4513:508238e65af7
[project @ 2003-09-19 21:40:57 by jwe]
author | jwe |
---|---|
date | Fri, 19 Sep 2003 21:41:21 +0000 |
parents | d7d9ca19960a |
children | 8e1c04e506ce |
comparison
equal
deleted
inserted
replaced
4512:b55eaa010770 | 4513:508238e65af7 |
---|---|
325 } | 325 } |
326 | 326 |
327 void | 327 void |
328 octave_cell::print_raw (std::ostream& os, bool) const | 328 octave_cell::print_raw (std::ostream& os, bool) const |
329 { | 329 { |
330 int nr = rows (); | 330 int ndims = matrix.ndims (); |
331 int nc = columns (); | 331 |
332 | 332 if (ndims == 2) |
333 if (nr > 0 && nc > 0) | 333 { |
334 int nr = rows (); | |
335 int nc = columns (); | |
336 | |
337 if (nr > 0 && nc > 0) | |
338 { | |
339 indent (os); | |
340 os << "{"; | |
341 newline (os); | |
342 | |
343 increment_indent_level (); | |
344 | |
345 for (int j = 0; j < nc; j++) | |
346 { | |
347 for (int i = 0; i < nr; i++) | |
348 { | |
349 OCTAVE_QUIT; | |
350 | |
351 OSSTREAM buf; | |
352 buf << "[" << i+1 << "," << j+1 << "]" << OSSTREAM_ENDS; | |
353 | |
354 octave_value val = matrix(i,j); | |
355 | |
356 val.print_with_name (os, OSSTREAM_STR (buf)); | |
357 | |
358 OSSTREAM_FREEZE (buf); | |
359 } | |
360 } | |
361 | |
362 decrement_indent_level (); | |
363 | |
364 indent (os); | |
365 os << "}"; | |
366 newline (os); | |
367 } | |
368 else | |
369 { | |
370 os << "{}"; | |
371 if (nr > 0 || nc > 0) | |
372 os << "(" << nr << "x" << nc << ")"; | |
373 os << "\n"; | |
374 } | |
375 } | |
376 else | |
334 { | 377 { |
335 indent (os); | 378 indent (os); |
336 os << "{"; | 379 os << "{"; |
380 dim_vector dv = matrix.dims (); | |
381 for (int i = 0; i < ndims; i++) | |
382 { | |
383 if (i > 0) | |
384 os << "x"; | |
385 os << dv(i); | |
386 } | |
387 os << " Cell Array}"; | |
337 newline (os); | 388 newline (os); |
338 | |
339 increment_indent_level (); | |
340 | |
341 for (int j = 0; j < nc; j++) | |
342 { | |
343 for (int i = 0; i < nr; i++) | |
344 { | |
345 OCTAVE_QUIT; | |
346 | |
347 OSSTREAM buf; | |
348 buf << "[" << i+1 << "," << j+1 << "]" << OSSTREAM_ENDS; | |
349 | |
350 octave_value val = matrix(i,j); | |
351 | |
352 val.print_with_name (os, OSSTREAM_STR (buf)); | |
353 | |
354 OSSTREAM_FREEZE (buf); | |
355 } | |
356 } | |
357 | |
358 decrement_indent_level (); | |
359 | |
360 indent (os); | |
361 os << "}"; | |
362 newline (os); | |
363 } | |
364 else | |
365 { | |
366 os << "{}"; | |
367 if (nr > 0 || nc > 0) | |
368 os << "(" << nr << "x" << nc << ")"; | |
369 os << "\n"; | |
370 } | 389 } |
371 } | 390 } |
372 | 391 |
373 bool | 392 bool |
374 octave_cell::print_name_tag (std::ostream& os, const std::string& name) const | 393 octave_cell::print_name_tag (std::ostream& os, const std::string& name) const |