[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: error with "end"
From: |
Joao Cardoso |
Subject: |
Re: error with "end" |
Date: |
Wed, 15 Sep 1999 04:33:13 +0100 |
Adam Balgach wrote:
>
> why does octave continually give me an error with the code...
>
> "b = reshape(x,s(n+1:end));"
try changing `end' with length(s). This question has already arised
here, `end' being the length of a vector. At the time I remember that
John Eaton asked if this was a valid Matlab construct, but nobody
answered. So I opened my win95 under sco-unix ;-), run my matlab 4.0,
and typed:
» a=1:10;
» a(1:end)
ans =
[]
» help end
END Terminates the scope of FOR, WHILE and IF statements.
Without END's, FOR, WHILE, and IF wait for further input.
Each END is paired with the closest previous unpaired
FOR, WHILE, or IF and serves to terminate its scope.
» version
ans =
4.0
»
so it seems that `end' is not valid here (neither with a strings)but I
remember using it in matlab... when I use to use matlab.
Also, under octave,
usage: reshape (a, m, n)
Form an m x n matrix from the elements of a (taken in Fortran's
column major ordering).
> ^
> specifically octave tells me that
> "parse error near lin 16 of file..."
>
> its has to do with "n+1:end" anyone know why this doesnt work? im trying to
> port all my matlab code to octave, and i need this function to be working by
> tommrow morning. thanks.
>
> (the code comes from Matlabs "shiftdim.m"...
> if (n > 0)
> n = rem(n-1,ndims(x))+1;
> if (isequal(siz(1:n),ones(1,n)))
> s = [siz ones(1,n+2-length(siz))];
> b = reshape(x,s(n+1:end));
> ^
>
> thanks.
> adam balgach
> address@hidden
>
> ---------------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL. To ensure
> that development continues, see www.che.wisc.edu/octave/giftform.html
> Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
> ---------------------------------------------------------------------
--
Joao Cardoso, INESC | e-mail:
R. Jose Falcao 110 | tel: + 351 2 2094345
4050 Porto, Portugal | fax: + 351 2 2008487
---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL. To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------