extracting rows in a matrix

James Sherman Jr. shermanj at umd.edu
Wed May 13 10:37:37 CDT 2009


Its complaining that "size(A0, 1)/10" is not an integer.  You'll have to do
one of either round, floor, or ceil depending on what you want to do.

On Wed, May 13, 2009 at 11:26 AM, Carlo Rossi <serosole at yahoo.it> wrote:

> hello,
>
>  what about this warning please (in matlab)?
>
>    tmp = A0(randperm (size(A0, 1)), :);
>    TT0 = tmp(1:size(A0, 1)/10, :);
>
> Warning: Integer operands are required for colon operator when used as
> index
>
>
> --- *Mer 13/5/09, John W. Eaton <jwe at octave.org>* ha scritto:
>
>
> Da: John W. Eaton <jwe at octave.org>
> Oggetto: Re: extracting rows in a matrix
> A: "Carlo Rossi" <serosole at yahoo.it>
> Cc: "Ben Abbott" <bpabbott at mac.com>, help-octave at octave.org
> Data: Mercoledì 13 maggio 2009, 15:27
>
> On 13-May-2009, Carlo Rossi wrote:
>
> | this is very cool but actually I need to write something that is good
> | for Matlab too; and I notice only now that it doens't work in Matlab
>
> | B = A(randperm (size (A, 1)), :)(1:size (A, 1)/5, :);
>
> Then write it like this:
>
>   tmp = A(randperm (size (A, 1)), :);
>   B = tmp(1:size (A, 1)/5, :);
>
> jwe
>
>
>
> _______________________________________________
> Help-octave mailing list
> Help-octave at octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20090513/3324554e/attachment.html 


More information about the Help-octave mailing list