« Return to Thread: Cell array (of structs) to array failure

Re: Cell array (of structs) to array failure

by Travis Collier :: Rate this Message:

Reply to Author | View in Thread

I'll provide an inefficient workaround for my own problem (just so in
case no one provides better).

[c{:}] fails with "error: octave_base_value::complex_array_value():
wrong type argument `struct'"

So, appending the cell array onto a struct array the implicit horzcat
way doesn't work.
Using an explicit loop does work, but of course isn't vectorized and
is only good for small arrays (really shouldn't be appending large
arrays anyway).

  for( tmp = 1:length(c) )
    if( ~isempty(c{tmp}) )
      cor = [cor c{tmp}]; % append elements of c to cor
    endif
  endfor

Yeah, I have a local variable named "cor"... shame on me.

------------------------------------------------------------------------------
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

 « Return to Thread: Cell array (of structs) to array failure