comparison src/ov-class.cc @ 13695:348857854c52

correctly handle multidimensional objects in num2cell * cellfun.cc (get_object_dims, do_object2cell): New functions. (Fnum2cell): Call do_object2cell to handle class objects. * ov-class.cc (octave_class::size): Return dims when size method is not available. * test_classes.m: Delete tests for concatenation and num2cell.
author John W. Eaton <jwe@octave.org>
date Wed, 12 Oct 2011 22:25:01 -0400
parents 441af0aa125a
children c7fac37a2afc
comparison
equal deleted inserted replaced
13694:441af0aa125a 13695:348857854c52
320 if (lv.length () > 0 && lv(0).is_matrix_type () && lv(0).dims ().is_vector ()) 320 if (lv.length () > 0 && lv(0).is_matrix_type () && lv(0).dims ().is_vector ())
321 retval = lv(0).matrix_value (); 321 retval = lv(0).matrix_value ();
322 else 322 else
323 error ("@%s/size: invalid return value", class_name ().c_str ()); 323 error ("@%s/size: invalid return value", class_name ().c_str ());
324 } 324 }
325 else
326 {
327 dim_vector dv = dims ();
328
329 int nel = dv.numel ();
330
331 retval.resize (1, nel);
332
333 for (int i = 0; i < nel; i++)
334 retval(i) = dv(i);
335 }
325 336
326 return retval; 337 return retval;
327 } 338 }
328 339
329 octave_idx_type 340 octave_idx_type