[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem plotting "N-d object"
From: |
Ben Abbott |
Subject: |
Re: problem plotting "N-d object" |
Date: |
Fri, 17 Feb 2012 11:06:07 -0500 |
On Feb 17, 2012, at 10:15 AM, Sergei Steshenko wrote:
> Hello,
>
> here is a screen session:
>
> "
> octave:3> foo(1,1,:) = [1 2 3]
> foo =
>
> ans(:,:,1) = 1
> ans(:,:,2) = 2
> ans(:,:,3) = 3
>
> octave:4> plot(foo(1,1,:));
> error: transpose not defined for N-d objects
> error: called from:
> error:
> /home/qemu/AFSWD/20111122/octave-3.4.2/share/octave/3.4.2/m/plot/private/__plt__.m
> at line 179, column 8
> error:
> /home/qemu/AFSWD/20111122/octave-3.4.2/share/octave/3.4.2/m/plot/private/__plt__.m
> at line 104, column 17
> error:
> /home/qemu/AFSWD/20111122/octave-3.4.2/share/octave/3.4.2/m/plot/plot.m at
> line 194, column 9
> octave:4> plot(foo(1,1,:)(:));
> octave:5>
>
> ".
>
> I don't understand why 'octave' complains about N-d objects - to me
> "foo(1,1,:)" looks like a 1-d object. Because the first two of the three
> indexes are fixed in the expression.
>
>
> And adding "(:)" solves the problem.
>
> Just wondering - should it be that hard for end user ? Does Matlab behave the
> sane way ?
>
> Thanks,
> Sergei.
For either plot(foo) or plot(foo(1,1,:), Matlab gives ...
plot (foo)
Error using plot
Data may not have more than 2 dimensions
Even so, maybe an appropriate solution is to check if the numberic inputs have
ndim > 2 and attempt to apply squeeze before throwing an error ?
If you like this idea, please open a feature request in the tracker.
https://savannah.gnu.org/bugs/?group=octave
Ben
- problem plotting "N-d object", Sergei Steshenko, 2012/02/17
- Re: problem plotting "N-d object",
Ben Abbott <=
- Re: problem plotting "N-d object", Sergei Steshenko, 2012/02/17
- Re: problem plotting "N-d object", Jordi Gutiérrez Hermoso, 2012/02/17
- Re: problem plotting "N-d object", Ben Abbott, 2012/02/17
- Re: problem plotting "N-d object", Jordi Gutiérrez Hermoso, 2012/02/17
- Re: problem plotting "N-d object", CdeMills, 2012/02/17
- Re: problem plotting "N-d object", Ben Abbott, 2012/02/17
- Re: problem plotting "N-d object", CdeMills, 2012/02/18
- Re: problem plotting "N-d object", Ben Abbott, 2012/02/18
- Re: problem plotting "N-d object", Jordi Gutiérrez Hermoso, 2012/02/18
- Re: problem plotting "N-d object", Sergei Steshenko, 2012/02/19