cell-array returned by anonymous function must be stored in variable before it can be indexed
John W. Eaton
jwe at bevo.che.wisc.edu
Thu Apr 3 12:15:09 CDT 2008
On 3-Apr-2008, Olaf Till wrote:
| Octave version: 3.0 (on Debian stable, from a package in unstable)
|
| If an anonymous function returns a cell-array, it can not be indexed
| directly:
|
| octave3.0:18> a = @ (x) {x}
| a =
|
| @(x) {x}
|
| octave3.0:19> a (1){1}
| error: scalar cannot be indexed with {
|
| but only indirectly:
|
| octave3.0:19> t = a (1)
| t =
|
| {
| [1,1] = 1
| }
|
| octave3.0:20> t{1}
| ans = 1
| octave3.0:21>
|
| Such issues (having to store in a temporary variable before indexing)
| are typical in Matlab, I saw it as an advantage of Octave that direct
| indexing is possible. Maybe it is possible to provide that feature
| (direct indexing) under all circumstances ...
Please try the following change.
Thanks,
jwe
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080403/a58afbf2/attachment.ksh
More information about the Bug-octave
mailing list