This site is a work in progress.
MATLAB is a computer program that can be used to analyse all kinds of data - It's basically a calculator on steroids. To get MATLAB to do what you want, you have to speak it's language.
MATLAB is very obedient - It will do exactly what you tell it to, so long as the instruction makes sense to it. So the onus is on you to communicate.
With the wrong instruction, it could (1) do nothing because what you asked didn't make sense, or (2) it could give you a nonsense answer because what you thought you asked MATLAB to do was different from what you actually told it to do. That's not so bad.
With the right instructions however, you can get MATLAB do quite complicated things, and automate boring and repetitive tasks.
Ok, so we want to learn how to speak in MATLAB but how should we go about it?
Learning MATLAB is like learning a new language - you only need to know a few words and some basic rules of the language to get started.
The best way to learn is to use it. Learn by trying new things you see online, making mistakes and fixing mistakes.
Take it from the top and go one line at a time.
Learn to get comfortable with error messages - don't feel bad when you get them - treat it as constructive feedback.
If you get an error message:
Make sure you read what the error is saying - it'll give you hints about what is wrong - e.g. a variable doesn't exist, or it can't find a specific file
Inspect all the inputs and outputs leading up to the error - check that all your variables are correctly defined, check for typos, check that the brackets are in the right place.
Look up the function documentation online, see if you are using the function properly - e.g. see if you are putting inputs in the right spot, if the inputs are of the right type.
Persistence is key, don't give up - Just keep looking online, trying different things and using the feedback you get from errors - you'll get it eventually.
If you're getting sick and tired of it, have a break and come back to it. If you don't think you can figure it out - ask for help.
It's important to be nice to yourself. Don't worry if you feel like you're not progressing as fast as you think you should - it doesn't mean that you're stupid, these things take time and effort. Make sure you celebrate your achievements!
Continue through the pages on this website - I'll try to cover the basics.
Watch some introductory videos on MATLAB - learn what variables, functions, indexing and 'for loops' are.
Youtube Video - Introducing to Programming - https://youtu.be/wb6BSM2ow8c
Scour the internet for basic tutorials on EEG analysis using MATLAB and follow those tutorials.
A MATLAB script is basically a list of instructions that gets you from one point to another. For example, we're trying to create a list of instructions that will help us get from (1) raw EEG data to (2) measured ERP amplitudes.
When you want to write a script:
The first thing to do is think about you want the code to do - think about what the end result should look like
Think about all the steps you need to take to get to that result - sometimes it helps to think about the steps you would take if you were to do it manually. Also, try to imagine what the output of each step should look like. The steps should build on each other.
Try to translate each step from english to MATLAB code.
If it's a function you don't understand - use google and look up the function documentation online, there should be some directions about what kind of inputs the function needs, and where to put the input parameters.
You could just google 'MATLAB and how to... <insert question>' and look up forum posts of people asking the same question.
Try to implement the solutions you see online - play around with the code by changing the inputs and parameters and see how that changes the output.
Understanding other people's code can be pretty difficult, but you'll soon learn to recognise what is useful and what is not.
If you've tried but are really stuck - ask someone.