Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Matlab assistance


  • Please log in to reply
3 replies to this topic

#1 EricMon

EricMon

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:05:44 AM

Posted 17 July 2012 - 09:29 PM

So i'm in a program at my college and we are involved in a matlab class...i am lost. He recently assigned us a project where we are to create a program that
1. prompts the user to enter a number between 2 and 12
2. display a message that tells them if the number is too low ( <2) or too high ( >12)
3. once the number is picked, it must show them a number. this is number is determined by how many times the number appears within our 10 by 10 matrix
that we are to create. If they pick 5 and it appears in the matrix 6 times, it should say "your number appeared 6 times in the matrix". sad part...this is due thursday 7/17. PLEASE help.

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:04:44 AM

Posted 18 July 2012 - 07:05 AM

We don't do homework. What we will do is help you when you get stuck after you show us what you have tried. Sorry, that's the only way to learn.

#3 EricMon

EricMon
  • Topic Starter

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:05:44 AM

Posted 18 July 2012 - 09:23 AM

Fair enough. i don't expect it to be done for me i did figure a few things out....I got the 10 by 10 vector to be created. I also got the 'Enter a number between 2 and 12' prompt to come up by entering this in the editor: test1=input('Enter Number between 2 and 12').
I am having trouble with the responses. Trying to get the program to reply with the message of whether the number was too low, high, or correct.

I attempted using a code like this:
if 'test1'<2
then input=('number too low')
end
But this didn't work...#confused

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:04:44 AM

Posted 18 July 2012 - 11:16 AM

Ok. What do you mean by 'it didn't work'? Did it generate an error of some sort? And can we see your exact code?

Are you trying to compare integers or strings? test1 is a string, the 2 is an integer. If test1 is a variable name, then you need to try if test1 < 2




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users