f

1 to 20 with x number of 1's, 2's, 3's, ... 20's

```This is probably a simple thing to do, so perhaps someone would send me in the right direction.

I need to generate a list containing numbers from 1 to 20, say. But I cant just use A = 1:20, for example, because that provides me only one instance of each of the values. What I need is X instances for each value. For example, 5 ones, twos, threes, and so forth.

Is there a simple command for this?

Regards,

Ulrik.
```
 0
Ulrik
9/9/2010 9:52:21 AM
comp.soft-sys.matlab 211265 articles. 25 followers. lunamoonmoon (257) is leader.

4 Replies
2447 Views

Similar Articles

[PageSpeed] 21

```On Sep 9, 10:52=A0am, "Ulrik Nash" <u...@sam.sdu.dk> wrote:
> This is probably a simple thing to do, so perhaps someone would send me i=
n the right direction.
>
> I need to generate a list containing numbers from 1 to 20, say. But I can=
t just use A =3D 1:20, for example, because that provides me only one insta=
nce of each of the values. What I need is X instances for each value. For e=
xample, 5 ones, twos, threes, and so forth.
>
> Is there a simple command for this?
>
> Regards,
>
> Ulrik.

x=3D5; %for example
desiredlist=3Dreshape(ones(x,1)*[1:20],1,20*x)

hth, suresh
```
 0
Suresh
9/9/2010 9:59:53 AM
```"Ulrik Nash" <uwn@sam.sdu.dk> wrote in message <i6aaol\$pvr\$1@fred.mathworks.com>...
> This is probably a simple thing to do, so perhaps someone would send me in the right direction.
>
> I need to generate a list containing numbers from 1 to 20, say. But I cant just use A = 1:20, for example, because that provides me only one instance of each of the values. What I need is X instances for each value. For example, 5 ones, twos, threes, and so forth.
>
> Is there a simple command for this?
>
> Regards,
>
> Ulrik.

A bit vague.  You need to provide sample input(s) and output.
```
 0
Steve
9/9/2010 10:00:24 AM
```Suresh <madzientist@gmail.com> wrote in message <fe399507-cf43-43b2-9839-e196331b87b5@q18g2000vbm.googlegroups.com>...
> On Sep 9, 10:52 am, "Ulrik Nash" <u...@sam.sdu.dk> wrote:
> > This is probably a simple thing to do, so perhaps someone would send me in the right direction.
> >
> > I need to generate a list containing numbers from 1 to 20, say. But I cant just use A = 1:20, for example, because that provides me only one instance of each of the values. What I need is X instances for each value. For example, 5 ones, twos, threes, and so forth.
> >
> > Is there a simple command for this?
> >
> > Regards,
> >
> > Ulrik.
>
>
> x=5; %for example
> desiredlist=reshape(ones(x,1)*[1:20],1,20*x)
>
> hth, suresh

Thank you very much Suresh, it did indeed help! :-)
```
 0
Ulrik
9/9/2010 10:07:05 AM
```"Steve Amphlett" <Firstname.Lastname@Where-I-Work.com> wrote in message <i6ab7o\$pqt\$1@fred.mathworks.com>...
> "Ulrik Nash" <uwn@sam.sdu.dk> wrote in message <i6aaol\$pvr\$1@fred.mathworks.com>...
> > This is probably a simple thing to do, so perhaps someone would send me in the right direction.
> >
> > I need to generate a list containing numbers from 1 to 20, say. But I cant just use A = 1:20, for example, because that provides me only one instance of each of the values. What I need is X instances for each value. For example, 5 ones, twos, threes, and so forth.
> >
> > Is there a simple command for this?
> >
> > Regards,
> >
> > Ulrik.
>
> A bit vague.  You need to provide sample input(s) and output.

Hi Steve, I will be less verbose and more numeric next time :-)
```
 0
Ulrik
9/9/2010 10:09:07 AM

Similar Artilces:

Python's __getattr__, Perl's autoload, Ruby's method_missing, and Smalltalk's #doesNotUnderstand
I'm still new here, and I just completed reading CLTL's documentation on packages and On Lisp's documentation on CLOS. It doesn't appear that Lisp has the equivalent of Python's __getattr__, Perl's autoload, Ruby's method_missing, and Smalltalk's #doesNotUnderstand. That is, there is no way I can do this (without new-function being defined): (new-function) and have it call some other function like this: (missing-symbol 'new-function) whose returning value will be evaluated as the value of new-function. Or did I miss something? Jonathan Gardner <...

Nvidia's 'Nalu' vs ATI's 'Ruby'
http://karpo.org/images/Dunno/Ruby.jpg Nvidia's GeForce 6800 (NV40) 'Nalu' demo consists of 300,000 polygons. very very impressive shit! ATI's Radeon X800 (R420) 'Ruby' demo consists of only 80,000 polygons. however it is also rendering a background with other elements. closer to what would be in an actual game. now, console gamers: keep in mind, whatever ATI has been able to come up with at this point (re: the R420 / Radeon X800) is a stepping stone to what they'll be able to have in 2005 for Xbox Next, and in 2006 for GCNext :) On 14 Apr 2004 21:33:15 -0700, nvidianv55@mail.com (NV55) wrote: >http://karpo.org/images/Dunno/Ruby.jpg > >Nvidia's GeForce 6800 (NV40) 'Nalu' demo consists of 300,000 polygons. >very very impressive shit! > >ATI's Radeon X800 (R420) 'Ruby' demo consists of only 80,000 polygons. >however it is also rendering a background with other elements. closer >to what would be in an actual game. > >now, console gamers: keep in mind, whatever ATI has been able to come >up with at this point (re: the R420 / Radeon X800) is a stepping stone >to what they'll be able to have in 2005 for Xbox Next, and in 2006 for >GCNext :) Wow............. I am impressed !! Must ask for an advanced payment of my Social Security to buy these consoles. Both should sink like rocks if not 100%backward compatible with existing non-Next software. Also, a huge marketing problem for n...

JSP, Servlet's, EJB's, Bean's?
I am currently developing an application where I call command line programs and capture the output. This is fine. What I am doing is creating a web interface for these programs using JSP/Servlets. What I would like to do is be able to call these programs. Using buttons or something, and dumping the output into a text area. I have a servlet that I generates the output that I need. My question is How do I get that output into the textarea? When I call a new function I want to be able to append the text to the end of the text area. I was told in another group that I would need a...

Gears of War's water, Bioshock's water, now Halo 3's water
http://www.xbox360fanboy.com/2006/11/11/frankie-is-obsessed-with-water/ ...

Look! Up in the sky! It's a bird! It's a plane! No-- it's WONDER
Yes, Wonder Chimpie-- strange primate from another planet!! Knows everything about IT (with the exception of a proxy server and how to kill file). All bow down when he comes around! Thank you, Wonder Chimpie, for saving us from ourselves! ~~~~~~~~~~~~~~~~~~~~~ This message was posted via one or more anonymous remailing services. The original sender is unknown. Any address shown in the From header is unverified. ...

It's a Bird, it's a plane, no! umm, it's Super Boid?
Hey Guys, I have something actually working that seems allot like Swarm Technology to me. The system features many smaller parts that seem allot like "Boids" (or "Agents"). I'd be tempted to call them "Dorts" because they get thrown straight at the target and fire on my machine at about 2,000 per second (in 1.9). Not very "natural" - one would not want to have mosquitoes able to do that :) There's no "in-flight" communication between the Boids - their life cycle involves trying to attain values for a list of required attributes and a docking with a "HelperClass" (see Ruleby also) for any in-depth calculations. They make their assertions, record all the results, and wait to be debriefed after they have landed. So are these things Boids or not? For example: They are fired sequentially so they are not buzzing around sending signals to each other. However, if a Boid is assigned a lower pass number it can "leave information" for a Boids fired on later passes - so there is inter_boidal_communications :) - but only after their "flight" / period of activity. It's taken me almost 3 years to get this all this far along Right now, however, I can go on localhost and author 10 new real almost guaranteed to work "Boids" easily in an hour.(When I started and did these by hand they could take a full day.) Mostly all I have to do now is make multiple choices. (Lots of Ruby ...

EA treats it's employee's worse than it's customers!
Just more reasons not to by Anything from EA http://www.livejournal.com/users/ea_spouse/ http://www.igda.org/qol/open_letter.php On Sun, 21 Nov 2004 14:30:51 GMT, "Bill" <mrspamnobillo@nospam.bom> wrote: >Just more reasons not to by Anything from EA > >http://www.livejournal.com/users/ea_spouse/ > >http://www.igda.org/qol/open_letter.php I would love to start boycotting EA because of their poor treatment of staff, but I am already boycotting them for making so many crap games they are actually damaging the industry and our art. "Bill" <mrsp...

What's the correllation between File I/O's and Disk I/O's
Hi We have a client that is getting poor response times. But it's not consistant. One person may have no problems one day while another is having huge delays, and the next day it's vice versa. The system we have does a lot of data entry. Depending on the data entered, a validation against files is required. We've done a lot of investigation into this, and one thing that we have noticed is that the number of Disk I/O's increases much faster than the File I/O's requested. One thing noticed was they had 9 disks, and disk 1 was going to 70-80% utilisation (WRKDSKSTS), which in turn caused the other 8 disks to increase in utilisation. The iSeries is not reporting damaged objects, files or access paths. Example File I/O's Disk I/O's Action 1: 155 127 Action 2: 230 478 Action 3: 285 400 Action 4: 340 377 Action 5: 420 1220 Action 6: 480 2720 Looking at the above example Actions 1-4 look OK to us (afte review the program source for Read/Writes and updates). But Actions 5 & 6 have much more Disk I/O than we'd expect. Should there be some sort of correllation between File I/O's and Disk I/O's? What governs Disk I/O is it the OS? Is there some configuration changes we might be able to make to help alleviate the problem? TIA John two things immediate. straspbal will balance the files by usage across disks more evenly some files are mostly found on...

seeing 1's and 0's
Dear all: Ok an learned about 1's and 0's and how to convert it decimal and back. But just wondering if it was possible to actually see the binaries in real life! In other words is it possible to actually open an executable and see all those 1's and 0's. From a geeky prespective, this would be kinda cool and a great way to learn this stuff! It would be kinda cool to change it lets say something that reads "google" to "googgle" by changing the binary itself. Any help would be greatly apprciated. Thanks in advance. al Alex Lee wrote: > Dear all: >...

2's complement vs. 1's complement vs. ...
Peter Nilsson wrote: > Keith Thompson wrote: >> A 2's-complement representation makes some operations easier, >And some harder. Could you expand this? What operations are easier using other representations? (Other than BCD, etc. for financial applications.) -- Roberto Waltman [ Please reply to the group. Return address is invalid ] Roberto Waltman <usenet@rwaltman.com> writes: > Peter Nilsson wrote: >> Keith Thompson wrote: > >>> A 2's-complement representation makes some operations easier, > >>And some harder. > > Could you expand this? What operations are easier using other > representations? (Other than BCD, etc. for financial applications.) I suspect (without looking it up) that multiplication and division with negative numbers is harder in two's complement than in sign-magnitude. -- "Programmers have the right to be ignorant of many details of your code and still make reasonable changes." --Kernighan and Plauger, _Software Tools_ Roberto Waltman <usenet@rwaltman.com> writes: >> Keith Thompson wrote: >>> A 2's-complement representation makes some operations easier, > >>And some harder. > > Could you expand this? What operations are easier using other > representations? (Other than BCD, etc. for financial applications.) The most obvious example is negation. In sign and magnitude, you just invert the sign bit. In ones' complement, y...

S*S'-> make a code program of DIFF (S) for S to excute expression:S*S, ( S=vector, S'=dS/dt). ideas to all?
hello everyone, now i need a help of ideas for a program style from all to find :S*S'. here we would not be able to use directly Diff( S) cuz of error of unsame size of S & diff( S). soo i dlove to get any code PROGRAM STYLEs for function S' ( dS/dt) to Find S*S', with S: vector, for example as a begining input: t=0:10; S=2*t.^3 +3*t; Now make a code program to DEFINE S' by ALGORITHM of MATH. dear all, my question going well for understanding?? iam waiting for all. ( hey, give a trial into the world of Math of Algorithm for function & diveritative)-) ...

Toronto: Now Accepting Resumes IT Professionals, CA's CGA's MBA's Financial Managers #2
Now Accepting Resumes ! We are getting ready for our busy season, and are now accepting resumes from active jobseekers. If you are an IT professional or Financial Manager we want to hear from you. We are planning a major marketing blitz to uncover those tough -to- find jobs out there, and you can be among the first to benefit. Both contractors and perm fulltime jobseekers are welcome. If you have previously sent a resume, you are invited to send us a new, up to date one to keep your information current. Resumes to jpapish (at) spectrumjobs.com We abide by PIPEDA and...

Toronto: Now Accepting Resumes IT Professionals, CA's CGA's MBA's Financial Managers #3
Now Accepting Resumes ! We are getting ready for our busy season, and are now accepting resumes from active jobseekers. If you are an IT professional or Financial Manager we want to hear from you. We are planning a major marketing blitz to uncover those tough -to- find jobs out there, and you can be among the first to benefit. Both contractors and perm fulltime jobseekers are welcome. If you have previously sent a resume, you are invited to send us a new, up to date one to keep your information current. Resumes to jpapish (at) spectrumjobs.com We abide by PIPEDA and...

SSG's Carrier's at War 2007
After 3 days in front of this game I'm happy to say that my initial doubts have been overcome and I'd like to thank the guys at SSG and Matrix for encouraging me to stick with it - and to Mr G. here too for a very important historical perspective. After a disappointment about a lack of print friendly manual (I succumbed to printing with the color backdrops) and the fact the game is crashing sporadically to DT (the boys at SSG are on to it) I'm willing to summarise the game thus: - Just like Battle's in Normandy, SSG is replicating history pretty closely with Carrie...

Prob's using Albert Kallal's SetDefaultPrinter on some OS's
I'm using Albert Kallall's code to set printers in A97. I find that on some machines, the code locks up and on others, it does not. I would like to overcome this and was wondering about the experiences of others who attempt to set default printer in A97? I have an app running on an XP home edition box fine. Same app running on XP Professional fails when SetDefaultPrinter() is called. I can post more of the code, which may be found at http://www.members.shaw.ca/AlbertKallal/msaccess/printch97.zip but I did not wish to clutter the post with too much that may distract from the question...

3 HOT DIRECT CLIENT Rek's : 1. Java Developer Analyst (6 Positions) 2. ORACLE DBA's (10g) (7 positions), 3. Portal Developer (4 positions)
Hi, We have 3 HOT DIRECT CLIENT Requirements: 1. Java Developer Analyst (6 Positions) 2. ORACLE DBA's (10g) (7 positions), 3. Portal Developer (4 positions) in Austin, TX., Please send me matching profile with rate, current location and Contact details ASAP to my official ID : isaac@preludesys.com Thanks and regards, Isaac Direct 213.233.3576 Office 213.233.3907 isaac@preludesys.com www.preludesys.com agasagi03@gmail.com 1. Job Title : Java Developer Analyst - Job Id: CAG10051301 & 2 Location : Austin, TX. Project Duration : 6+ Month(s) Est Start Date ...

Trial of Musatov's theory: double spaced 'e x p a n d s' and single spaced 'c o n t r a c t s'. Does the spacing post-processing appear equal? If so, what force was lost and where did it g
Musatov's theory 'The space between spaces expands and contracts.' Would this give time a direction? Musatov ...

[News] Microsoft's 'Future' is Linux's Yesterday
Parallel Computing`s Already Here ,----[ Quote ] | Microsoft's Craig Mundie is right. Parallel computing is going to change | everything about computing, but his timing is off. Thanks to Linux, it's been | here for years. | | The future is today. | | [...] | | It's not just video though. Supercomputers are made up of MPP arrays of | hundred or even thousands of ordinary Intel or AMD chips running Linux. The | current top supercomputer, the IBM Blue Gene/L system at the Lawrence | Livermore Lab, can hit 478.2 teraflops (trillion calculations per second) | with its tens of thousands of PowerPC processors running Linux. Indeed, 85.2 | percent of the fastest 500 supercomputers in the world run Linux. | | Besides doing things that you won't notice in your day-to-day life, like | busting down the human genome into smaller and more comprehensive pieces and | getting weather prediction closer to a science than an educated guess, almost | every time you watch a movie with digital special effects you're seeing | Linux, multicore processors and parallel processing at work. | | Autodesk's Linux-based digital visual effect program Flame, for example, has | been used in movies from the children's movie "Charlotte's Web" to the | re-launch of James Bond in "Casino Royale" to swashbuckling in "Pirates of | the Caribbean: At World's End" and, of course, science fiction thrillers | like "Fan...

0's & 1's matrix
Hello, I've got a huge matrix with only 0's and 1's on it separated by spaces. I need to delete every row which has less than 10 (or any given number) on 1's. Any ideas, please? -- Saludos, Angel Angel wrote: > Hello, > > I've got a huge matrix with only 0's and 1's on it separated by spaces. > I need to delete every row which has less than 10 (or any given number) > on 1's. Any ideas, please? > awk '{for(i=1;i<NF;i++} n+=\$i;if(n>=LIMIT)print \$0;n=0}' infile > outfile Angel wrote: > I've got ...

90's Game -- Spielberg's "Director's Chair"
This seems like a long shot (get it...long shot?) but is anybody reading this group familiar with a game called Steven Spielberg's Director's Chair from the mid-nineties? Actually, it's more of a movie- studio familiarizer than a game, per se, but it does have its strong points in terms of recreating a certain, Hollywood-y atmosphere. I'm curious because, when I run this program on a Windows 2000 box, I keep hitting an "Internal Error" during my first dip in The Lab. I can hear the first line of dialogue repeat about three times, then it shuts me down. Becau...

quest for help: What's wrong with maple('GramSchmidt',[1 2;3 4])
not easy! ...

For Tariq the birth's standard, until me it's precious, whereas by you it's searching dependent.
spanner. Winston let out the water and disgustedly removed the clot of human hair that had blocked up the pipe. He cleaned his fingers as best he could in the cold water from the tap and went back into the other room. 'Up with your hands!' yelled a savage voice. A handsome, tough-looking boy of nine had popped up from behind the table and was menacing him with a toy automatic pistol, while his small sister, about two years younger, made the same gesture with a fragment of wood. Both of them were dressed in the blue shorts, grey shirts, and red neckerchiefs ...

The Python's regex different from Perl's ,I want know what's the different?
The Python's regex different from Perl's ,I want know what's the different? > The Python's regex different from Perl's ,I want know what's the > different? Easy: bash\$ diff <(lynx -dump http://perldoc.perl.org/perlre.html) <(lynx -dump http://docs.python.org/library/re.html) Had you tried the great Google in the sky, you might have found such pages as: http://mail.python.org/pipermail/python-list/2005-April/319030.html or even a popular book on the subject: http://oreilly.com/catalog/9780596002893/ -tkc The regular expression syntax is ...

Are the number of predefined 'errno's the same across platforms? How to avoid clashing of 'errno's from different libraries?
In my ubuntu machine, there are the following 'errno's defined. I looked at the specification draft (n1256.pdf), and I didn't see how many 'errno's are defined. (Please let me know if I overlooked anything.) Are the number of predefined 'errno's the same across platforms? It seems that libraries other than C standard library can define their own 'errno's. I'm wondering how to avoid clashing of the 'errno's from different libraries? \$ cat main.c #include<stdio.h> #include<string.h> int main(void) { int n; for(n ...

Web resources about - 1 to 20 with x number of 1's, 2's, 3's, ... 20's - comp.soft-sys.matlab

Resources last updated: 3/17/2016 2:21:23 PM