Be the first to rate this file! 0 Downloads (last 30 days) File Size: 1.73 KB File ID: #23895
image thumbnail

MATLAB Responds to Greeting

by Ahmad

 

25 Apr 2009

MATLAB replies back when you type "hi" into the command window, with eleven possible responses.

| Watch this File

File Information
Description

Typing the word "hi" in the command window will trigger MATLAB to randomly select one of eleven possible text responses to your greeting. Some are friendly, others are not.

This file is meant to have some fun with MATLAB. You may modify the program to make more possible responses, change the text responses, and so on. I was inspired to make this file when I found out about MATLAB's internal file called "why." Type that word into your command window for some strange philosophy.

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
27 Apr 2009 Matt Fig

Looking at the code I have some suggestions.

Do you really need the vector M? (No)
Why not put all your responses into a 12x1 cell then index into the cell array instead of nesting so many if else statements? Or you could use a switchyard.
Why is your function named cold_chat but saved as hi?

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
hi why response fun boredom laughs play game Ahmad 27 Apr 2009 10:59:24

Contact us at files@mathworks.com