MATLAB MEAL GENERATOR
Oct 2023

OBJECTIVE
My husband and I both like to cook but neither one of us are very good meal planners. We have a running list of favorite household meals, so I decided to use the problem as a chance to refamiliarize myself with coding in MATLAB.
SKILLS SNAPSHOT
MATLAB
PSEUDOCODE
EXCEL DATA IMPORT
DESIGN STEPS
Phase 1:
-
Created a one-column spreadsheet listing our favorite meals
-
Referenced the location of the spreadsheet in MATLAB
-
imported the strings for the name of each meal into a table
-
Created a simple random number generator bounded by the number of entries (which I accomplished by having Matlab stop at the first empty cell)
-
Wrote a prompt for the user to ask for a meal
-
Displayed meal associated with the randomly selected number​
​
Phase 2:
-
Expanded the spreadsheet to include a new column with a category, either "main", "side", or "dessert"
-
Created three tables in MATLAB instead of one: "mains", "sides" and "desserts"
-
Populated each table with the appropriate meals, skipping over incorrect meals for the category (eg: the table "mains" might have two entries, then an empty line where the Excel table listed a dessert)
-
Deleted empty rows
-
Initiated three counters for how many mains, sides, or desserts are in each table
-
Created three random number generators for each type of meal, bounded by how many entries are in each table
-
-
Updated the prompt for the user to select whether they wanted a main dish, a side dish, a dessert, or a full meal (main + side + dessert)
-
Displayed multiple strings to the user according to their desired output
RESULTS
I now have a quick and reliable way of generating meal ideas! I can add as many entries as I want into the Excel spreadsheet without needing any changes to the MATLAB script. Not bad for an ME writing code!​
FUTURE WORK
I'd like to be able to add tags to each spreadsheet entry so that I could ask for "comfort food" or "date night" meals. Apart from that, I'd also be interested in being able to ask for meal ideas with particular ingredients. For now though, the meal generator does what I need it to!
SKILLS DEMONSTRATED
-
MATLAB Programming
-
Pseudocode Planning
-
Data Import from Excel
-
Script Debugging
-

The Excel spreadsheet, listing and categorizing our favorite meals

The prompt asking for a user's meal preference

The results! The meal generator suggests we have turkey meatballs, rice pilaf, and brownies
A pdf of the MATLAB Meal Generator script