help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what is the proper syntax ?


From: James Sherman Jr.
Subject: Re: what is the proper syntax ?
Date: Mon, 17 Aug 2009 12:46:29 -0400

This is just a matrix dimension problem.  Your vector [1 2 3] is 1x3
and the function ones(m,n) returns a matrix of ones of the size m x n.
 So, what you want to do is:

ones(10,1)*[1 2 3]

Though, if you just want tile that vector 10 times vertically, you can just do

repmat([1 2 3], [10 1])

which is more efficient.

On Mon, Aug 17, 2009 at 12:29 PM, Christoph
Ellenberger<address@hidden> wrote:
> Sorry to bother with something so trivial but I am not finding the proper 
> syntax anywhere.
>
> I try to extend a vector [1 2 3] into a matrix
> 1 2 3
> 1 2 3
> 1 2 3
> ...
>
> using any possible combination I think it might be (also the ones I am sure 
> they are not)
>
> [1 2 3].* ones(10,1)
> [1 2 3].* ones(10,3)
> [1 2 3].* ones(10,1)'
> [1 2 3].* ones(10,3)'
> [1 2 3]* ones(10,1)
> [1 2 3]* ones(10,3)
> [1 2 3]* ones(10,1)'
> [1 2 3]* ones(10,3)'
> ...
>
> and I always get an error using MinGW 3.2.0. Can someone point me to the 
> proper syntax and confirm that it is or is not a bug ?
>
> Thank you very much
> christoph
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]