BASIC Step 2: Completing BASIC training

Directions for completing BASIC worksheets

Did you do Step 1 already?

You should have already made your Mathworks account and accessed the "comppedagogy" folder in MATLAB Online. If not, go back to Step 1: https://kb.wisc.edu/smng/internal/106101 

Introduction to command line worksheets

Worksheets A and B will introduce you to the command line, both on the lab computers and in Matlab. Complete Worksheets A and B before Worksheets 1-10. 

Click here to start on Worksheet A! Then, Worksheet B.

Matlab worksheets

Worksheets 1-10 introduce you to working in Matlab, including general coding skills and lab-specific functions. These worksheets are available ONLY in the Matlab Drive folder. Access the Matlab Drive by going to matlab.mathworks.com. Sign in and click Open Matlab Online. You should now see a web-based version of the Matlab window. In the Current Folder pane, navigate to /MATLAB Drive/comppedagogy/worksheets and double-click to open worksheet1_introToMatlab.m. (You can ignore any files that ends in .asv.) The subsequent worksheets are also in that folder.

You will not be able to edit these worksheets, which is simply a failsafe to make sure things don't accidentally get deleted or changed. However, this also means that you will not be able to save your worksheets into the Matlab drive folder, but rather will have to save into your own folder. 

When you are done with your answers to worksheets, check your work using the answer keys located in the folder "answerKeys" in the online Matlab comppedagogy drive. If you do not understand something, feel free to ask fellow undergrads in the lab, either in person or in the BASIC channel on Slack. If you want to keep your worksheets locally, you can download the final version of your worksheet from online Matlab into a folder on your own computer. (Note: You can download .m and .mat files even if you don't have Matlab installed on your computer.)

Topics covered by the BASIC worksheets: 

1. Introduction to Matlab paths
2. Variables
3. Input arguments for functions
4. If statements
4s (supplement): More practice with logical operations and switch/case
5. SMNG function walkthrough (audioGUI and waverunner)
6. Indexing
7. Structure arrays
8. For loops
9. While loops
10. SMNG function walkthrough II (run...expt and run...audapter)

How to troubleshoot code problems

 

As you learn to code, you will inevitably write non-functional code. Do not panic! A large portion of learning how to code is simply learning how to troubleshoot and google effectively. Just follow this list to coding bliss when you are practicing---in our experience, we rarely get past item 7 before we realize what we've done wrong.

  1. If you are getting an error message, read the error message carefully.
    1. Some error messages come with helpful suggestions!
    2. Sometimes a google search with your error text will be helpful. (I almost dedicated my dissertation to the people who had asked and answered questions on Google.)
  2. Read the instructions very carefully (when independently coding: remember what the goal of the code is)
  3. Check for typos
  4. Check again for typos! Common problems:a. Spaces in all the right placesb. Accidental capitalization or lowercasec. All brackets, parentheses, and string quotes are opened AND closedd. You've accidentally put an apostrophe in your string ' and didn't mark it appropriately
  5. Check for path errors. Common problems:a. A Matlab function you're trying to use is not on the path;b. Your path is wrong (particularly if hard-defined in the code. Very hazardous when moving between different computers with different directory names!)
  6. Ask someone that is working in the lab with you! Many other students have been through BASIC or are currently working on it as well, and are perfectly positioned to help you troubleshoot. 
  7. Start writing a message to the BASIC Slack channel. Include what you're trying to do, what the error is, and what you've done so far to try to fix it. This just helps you reach a broader audience than who is in the lab with you at that particular moment. (Frequently, Sarah and I get to this point and instantly come up with the solution before we even send the message. Much like how you find typos in your term papers as soon as you submit them!)
  8. If that fails and the course leaders haven't seen the message on the channel yet, ping us so you can get more help, or come into office hours if they are being held. Sometimes the bugs run deeper than what you have the capacity to tinker with.

Everyone should feel empowered to help troubleshoot problems from other students in the BASIC channel! 



KeywordsBASIC   Doc ID111684
OwnerRobin K.GroupSMNG Lab Manual
Created2021-06-15 11:39:23Updated2023-03-01 17:10:54
SitesSpeech Motor Neuroscience Group
Feedback  0   0