[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do I translate Matlab's colon into Octave?
From: |
Jeppe Sigbrandt |
Subject: |
Re: How do I translate Matlab's colon into Octave? |
Date: |
Fri, 5 Sep 1997 17:08:43 +0100 |
> From: Dirk Laurie <address@hidden>
> I've got zillions of old Matlab 3.5 routines that rely on one of the
> following devices:
>
> 1. x(:) returns the contents of x as a column vector
> 2. y(:)=x assigns the contents of x to y, retaining the
> present shape of y
Dirk,
Am not sure I understand the problem. Isn't this doing
what you ask?
octave:2> x=1:10;
octave:3> x(:)
ans =
1 2 3 4 5 6 7 8 9 10
octave:4> y=zeros(10,1);
octave:5> y(:)=x
y =
1
2
3
4
5
6
7
8
9
10
Notice that I deliberately tried to confuse octave
by feeding y (10 rows, 1 column) the vector x
(10 columns, 1 row).
Regards,
jay