Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Generating a column array

Subject: Generating a column array

From: Yumnam Kirani

Date: 10 Dec, 2010 10:15:05

Message: 1 of 3

How many ways do you know about generating a column array?
>>(1:14)' % is the one we usually use
But did you know that we can generate such column of arrays using the color function provided in Matlab? Wondered! I am not telling lie. You use the following commands to generate columns of arrays.
>> color whatisyourname
% this will generate the same column of arrays as by (1:14)'
write anything of n characters to generate a column of n numbers.
>>color 11111111111111111111
% this will generate the column array (1:20)' as there are 20 1's.
But not that you shout not give a space in the above argument of color.
If you want to put space, you can enclose them in single quotes.
>>color 'color function is interesting'
this will generate a column array of length 29.
Hope you will try.
Finally, What I want to say is, new year is coming. Save your money for buying new calendar. You can use the calendar of 2005 as calendar of 2011.
Thank You

Subject: Generating a column array

From: Steven_Lord

Date: 10 Dec, 2010 14:50:35

Message: 2 of 3



"Yumnam Kirani" <kirani.singh@gmail.com> wrote in message
news:idsuj9$m89$1@fred.mathworks.com...
> How many ways do you know about generating a column array?
>>>(1:14)' % is the one we usually use
> But did you know that we can generate such column of arrays using the
> color function provided in Matlab? Wondered! I am not telling lie. You use
> the following commands to generate columns of arrays.
>>> color whatisyourname

COLOR is a helper function for Optimization Toolbox and isn't really
intended to be generally used.

If you're looking to create arbitrary matrices, there are plenty of other
functions you can use. If you type "help elmat" without the quotes at the
MATLAB prompt, you'll see a number of different functions -- everything from
ONES and ZEROS to more exotic functions like VANDER, ROSSER, and one of my
personal favorites, GALLERY.

Other options include RAND, RANDN, and RANDI which generate random uniform,
normal, or uniform integer data respectively.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlab.wikia.com/wiki/FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Generating a column array

From: Yumnam Kirani

Date: 10 Dec, 2010 16:08:05

Message: 3 of 3

Thank you for your reply. I was just enjoying the strange properties of the color function which most of the people would have not known earlier. That is why I was just sharing so that other people can also enjoy its strange behaviour.

Thank you again.
Yumnam Kirani Singh

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us