2010/5/3 <[email protected]>

> Hi.
>
> In a netcdf file, I have "bin" as one of the dimensions with length 20
> elements. I want to reduce it to 10 elements. With matlab, this can be done
> with:
> B = nc('bin');
> B=resize(B,10);
> Could you please tell me, how that can be done in octave/octcdf.
>

Hi

what does matlab's D=nc(...) do? I assume it reads a file named 'bin' and
stores the data in array B. Not sure what you mean by "reduce" and what
matlab's function resize() does exactly.

1) octave has a function reshape() which can for example convert a 3x3
matrix into a 9x1 matrix.
Is that what you meant? Example:

> D = rand(3)
D =
   0.86725   0.95708   0.33266
   0.44080   0.70709   0.60520
   0.30770   0.79285   0.86423

octave.exe:14:Y:\math-fit
> reshape(D,1,9)
ans =
   0.86725   0.44080   0.30770   0.95708   0.70709   0.79285   0.33266
0.60520   0.86423


2) Or do you want cut away everything except some elements? Like this:

> D = rand(1,7)
D =
   0.031240   0.378192   0.567411   0.390658   0.509707   0.610917
0.580261
> D(1:5)
ans =
   0.031240   0.378192   0.567411   0.390658   0.509707

Or something different?

Stefan


>
> Thanks,
> Nands
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Octave-dev mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/octave-dev
>
------------------------------------------------------------------------------
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to