Re: How to create a matrix out of a vector



>>> one of the many solutions
>>> v=1:4;
>>> m=repmat(v,10,1)
>>
>> Thank you. When you mention "one of many" i get
>> curious - what more is there?
>>
> Some more of the many solutions:
> % using kronecker tensor product
> kron(ones(1,20),v')
> % this is what happens inside repmat
> v(ones(1,20),:)'

Ok, got it. The last one is what i actually use most of the time
since i never remember the special name but always remember
some algebra.

Thanks!

> it´s easier to follow when you or someone else is debugging
> the code.


What debugging? My code never needs debug. I always get it
right the first time, you know. ;)

--

Vänligen
Konrad
---------------------------------------------------

Sleep - thing used by ineffective people
as a substitute for coffee

Ambition - a poor excuse for not having
enough sense to be lazy

---------------------------------------------------

.



Relevant Pages

  • Re: gridview paging oddity
    ... Typically, when you encounter something not working on the first click, but ... In debugging, it runs thru the code just like it should ... without error the first time thru and loads the page as planned. ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: gridview paging oddity
    ... "JohnE" wrote: ... In debugging, it runs thru the code just like it should ... without error the first time thru and loads the page as planned. ... shows false when hovering over it. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Reverse comma operator?
    ... If you write it properly the first time (so ... it makes logic errors that much easier to spot. ... Debugging is twice as hard as writing the code in the first place. ... Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. ...
    (comp.lang.c)
  • Re: Eratosthenes sliding sieve
    ... Then it ran first time, no debugging.) ... Mwaaah. ... Try 10 primes. ...
    (comp.lang.forth)