Monday, May 11, 2009

GRRRRRRRRRRR

So in visual basic it is:

Do
intnumber = Int((4 - 1 + 1) * Rnd + 1)
Loop Until orderchecker(intnumber) < 25
orderchecker(intnumber) = orderchecker(intnumber) + 1

Select Case intnumber


but I am in matlab. PAH.

One day my brain will click and I will be the best programmer in the world.. or at least able to get done what I want to get done in a reasonable time without having to exercise trial and error!

The upside is I know someone who has given me some tips... the downside - I am too stupid to impliment them.

7 Comments:

Blogger eeyore said...

that took me back to writing algorithms in Algol at college. We had to wait for the computer operator to run our programmes through the college computer. Then we would return, days later, to find a pile of waste paper and a note "card input error at line 480". Back to the punch to change line 480 to have another go and leave the pile of cards for the computer operator to run...to return a few days laterto find a pile of paper etc...

You don't know how lucky you are!

6:35 PM  
Blogger James said...

I sympathise. At the moment, I'm trying to teach Flash to a group of Year 10 children, none of whom have any patience whatsoever. Debugging consists of them punching the screen, swearing, and announcing that they give up.

9:55 AM  
Anonymous Anonymous said...

I am not a programmer but I was using Matlab and Simulink to generate algorthms for a DSP. The company decided that Matlab was too expensive and I had to start again with VisSim. I now use this for my modelling along with Mathcad. VisSim is like Simulink in that it uses block diagram format for programming and modelling.

1:24 PM  
Blogger MortimerBones said...

oooh - dont suppose you know what the select case comparison is? I want to
generate the random number 1 or 2

select case generated number (1)
do the gubbins

select case generated number (2)
do the gubbins

end

1:27 PM  
Anonymous Anonymous said...

Matlab uses randperm(n) to generate random intergers between 1 and n.

For case can't you just use if statements?

9:03 AM  
Anonymous Anonymous said...

try

for i=1:20
x = ceil(2*rand);
switch x
case{1}
disp('One')
case {2}
disp('Two')
end
end


Alan

11:25 AM  
Blogger KG1 said...

Hiya Bones

I dunno if you've been there but

http://www.mathworks.co.uk/matlabcentral/index.html

Might have some help on there for you.

Keith

5:03 PM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home