Matlab basics 2020
We use hackmd which is like a google doc, but more useful to share simple text (like code). โฆAlso because Zoom chat is useless for anything productive. โโฟโ
Click on the pencil above to start editing this document. Ask questions or write comments always at the very bottom of the document. Click on the eye icon when you do not need to edit.
Some useful infos
- zoom link for the sessions
https://aalto.zoom.us/j/62815248114
the sessions will be recorded and published on YouTube, so by default your microphones will be muted. If you wish to talk, raise your hand using zoom controls so that I can unmute you. Remember it will be recorded and published.
-
Make sure your zoom name is the same that you used to register for the course.
-
There are 4 sessions. See details here.
-
We need to move the session of 18/11 to a different day. Please pick your preferred option by visiting this link -> https://presemo.aalto.fi/matlab
-
To do before the workshop
- Every participant will code during the workshops, so make sure you have a working copy of Matlab on your personal computer.
- Make sure you also have an active account on https://www.mathworks.com/ by using your Aalto email (or your institution email) as this will unlock educational features on Matlab's website.
- Make sure you download the data that we will use during the course by following the instructions at https://swcarpentry.github.io/matlab-novice-inflammation/setup.html
- for those who need the credit or certificate, see detailed info here.
IceBreaker: your learning goals
Write down what you expect/wish to learn from this course.
- To understand in what situations is better / more convenient to use Matlab than Python
- To learn to do some graphics with Matlab and to handle large data sets
- To pick up how to learn Matlab on one's own; I feel a threshold in just trying to understand what people are writing about on Stack Exchange
- Edit: Okay, I feel silly now, seeing the wealth of available resources. I was reflecting on my bad start with Python last month, which was more my own fault.
- To learn how to plot data
- to learn how to use existing code for data analysis and visualize data
- To be able to take advantage of this in my course exercises
- Learn to read the basic syntax / code others wrote
- To learn how to build a simple DNN like VGG-8 or LeNET-5 to interface with other EDA software like Cadence for NPU development and optimization
- My (graduate and undergraduate) students are fluent with Matlab. I want to know the basics of it so that I can guide them and know, what I can expect of them.
- Learn the basics of Matlab
- Use Matlab libraries
- Extrapolation and interpolation of data
- To learn basics
- To be able to make nice figures (also in color)
- To learn how to visualize data in 2D and 3D.
- To learn the basics to edit and modify codes that others wrote.
-
When is a section useful?
- The main usefulness of comments (%) and sections (%%) is for the reader. I advise to always write comments first and then the actual code that should come after. Sections have an extra advantage because you can tell matlab to execute only a specific section of a long script. This can be useful, but it can also be tricky (e.g. sections can be manually executed in different order than written in the script and that can lead to unwanted behaviour).
-
.
-
Is it possible to get both the credit for this course and the certificate?
- Sure! But for the credit you need to be an Aalto student with an Aalto student ID (I have no power to give credits to FiTech or Helsinki.fi). You can however "transform" the certificate into a credit with your organisation.
-
I am unable to use backspace, is it a normal feature or do I have something wrong here. Yes it works fine here. On Matlab it takes me to the end of the ''code''.
- I assume it's backspace in the Matlab command window, right? E.g. backspace would work here if you want to delete something. Ok I can mention about these options.
-
I could ue the readmatrix command. I guess you might have not loaded the "module" that contains this function (I'm not sure that it is a function). I'm using the last version of MatLab
- Good! I am not sure why my matlab doesnt find it. Ok, it was introduced in R2019a, I am running R2017a. This is a good thing to mention in general, thanks.
-
How can I "flip" y-axis, if I want low values on bottom?
-
How do I paste multiple lines of code?
- check shortcuts of operating sys
-
When are you uploading the video? It would be nice to have it in case we need some help with the exercises.
-
How can I change the sign of only one colum in the matrix?
- with dot product and a matrix of ones and ""-1s"
Highly recommended: https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005510
Feedback about day 1
Write something positive and something that could be improved about today's session
Thanks for the course! The speed is very good, so the clarifications are possible and complete!
I know it is too early at this moment, but maybe at the end would be possible to make a session with data simulations - i.e. simulate data to study some phenomena, or processโฆ
Good: started from very basics. Went in some places perhaps a bit fast, if one wanted to code at the same time.
Good session. Easy to follow
It was a great sessiion
Can we have something similar for Python especailly a learning space like the Matlab onramp
It was easy to follow, which was very good! I don't have anything that should be improved. Looking forward to the next session :-)
Very nice. Especialle the anonymous question platform is good, it is easy to ask them this way. Pace was good, even for me who has no earlier experience from programming.
The pace was good and created a good working flow.
Very well organised. No suggestions for changes now. :)
Icebreaker day 2
Do you know or can you google a Matlab toolbox NOT developed by matlab that is/could be useful for your work? Can you paste a link to it?
Error in plot_patient1 (line 1) patient_data = readmatrix('inflammation-01.csv');
-
I discovered the same yesterday, it relates to your version of MATLAB. I also have a version older than R2019a, so you you need to use another function like "load"
-
Enrico, the audio continues cutting off. Could you do something about it? Perhaps the place you are now (livingroom, dinningroom, โฆ)?
- I have the same connection as yesterday, I use mobile internet so there might be something today with the Telia network. :( The signal strength is high, so I think the bottleneck is somewhere else in the internet.
-
Could you tell us more about the command window and the editor and their differences? Pretty clear that editor is for saving scripts and command window is for playing around, but what more is there to consider?
- We can check this at the end if there's time
-
Please slow down. The connecting is loosing, very hard to follow
-
Not sure why but for me it shows:
โโโโโโ >> files = dir('data/inflammation-*.csv')
โโโโโโ files =
โโโโโโ 0ร1 empty struct array with fields:
โโโโโโ name
โโโโโโ folder
โโโโโโ date
โโโโโโ bytes
โโโโโโ isdir
โโโโโโ datenum
- this means that you might not have the
data
subfolder under your location where you are right now. If you do "ls" you should be able to see if you have "data". Otherwise you need to "cd" to the parent folder of "data". E.g. in my case this is: '/Users/enrico/code/matlabcourse/AY20202021/MatlabBasics2020/SCMatlab/'
- so I would need to "cd /Users/enrico/code/matlabcourse/AY20202021/MatlabBasics2020/SCMatlab/"
- and then from there type "ls"
- and see that I have "data" as output
- Got it, thanks! I had the .csv files contained in the same folder as the plot_all.m
-
The coding parts feel a bit rushed/fast and it is hard to keep up, especially if one makes a typo or some other error while writing the script
- Thanks for the feedback, I will try to go a bit slower
-
The plot_all command worked, but there is a strange warning at the end of the output: Warning: Direct access of structure fields returned by a function call (e.g., call to plot_all) is not allowed. What does this warning mean?
- We can check it at the end
- Can you maybe come back to this question please?
-
Where to check all possible file formats for saving the figures or images?
-
why do we need the "==" sign?
Feedback for today
Forgot to ask for feedback for todayโฆ could you still type it here below if you were attending the second session? Write something good about, and something that could be improved.
- feedback here
- write here
- or here
- .
- .
- .
- .
Day 3 - Matlab Basics
Icebreaker - Revise your learning goals + wishes for last lecture
Now that you are a bit more familiar with Matlab, what would you like to hear in the last lecture next Thursday? Topics span between: input (data loading, working with big data), processing (computing tips, parallel computing), output (saving processed data, making advanced figures)
- To introduce the most useful "advanced" functionality of MatLab according to your experience
- I would like to hear/see more about making figures (e.g. 3D, colorful figures etc)
- To see how to hanlge large dataset.
- To see if it is possible to do interactive pictures with Matlab. That is a 3-d image you can turn around and zoom in
- Would the beginnings of signal processing be possible to cover?
- Best practice/conventions for handling large data (input/output)
- Maybe also go through procedure to solve physics related problems with matlab.
- etc
- .signal processing would be useful for me
- Any tips about using version control with matlab. I was at the code refinery too and would like to know where from to use git commands.
- .
- .Could you also show one point how to load text data and making plot from text data
Icebreaker 2: would you be interested in taking Matlab advanced course in 2021? January? Feb? March? April?
- Yes, Januaryโฆ
- Yes, any month.
- Yes, Preferably Feb-March (second hald of January too)
- Yes. Either Feb or March
- Yes, any month. I would also like to learn about SPM, if this would be possible
- Yes in February or March too.
- yes, in Januaray
- yes, maybe not janyary, any other if good
- Yes, March will be more preferable(Might work with Jan).
- Very much interested.Jan would be nice
- Yes, February is preferable
- Yes, Jan is preferable
Questions here below
- Is it really the best practice to have one function per file. Or would it make sense to have in some situations more than one fucntion in a single file?
- It depends :) Sometimes you have a main function that then needs to call multiple subfunctions, in that case they can all be in the same file. The subfunctions however will be kind of "invisible" from your command window. But in general yes, we have one function per file and often they are grouped into the same subfolder to form a toolbox.
- I got totally lost in the back and forth when creating the plot_dataset function, sorry. I couldn't follow what I should have copied and what I needed to add. I can check everything with the exercise solution
- When will the video be online? My colleague could not make it today.
- Would it be possible to have an example of inspecting a novel data set - e.g. a stack of MRI scans, or a data from some other scanner (e.g. EEG data)? It would be great to learn basics on how to inspect, open and handle a data set that we are not familiar with.
- You have to allow others' microphones on Zoom.
- .
Feedback for the day
Write something good and something that could be improved about today's lecture
- The course progression is a great learning process on how pedant and tidy should be your code "bookeeping". Today I spent some time searching scripts and parts of the code from the last week
- I dont even want to think if I was searching for some scripts from last year! The general couse progression is very good, building the understanding gradually, based on previously acquired knowledge. Videos are going to be very useful.
- The progression and reasoning was very clear so I think the video will be very good. Unfortunately, I kept falling behind and losing track today, even though I was perfectly on track the last two training lectures.
- I liked that we had time to try the exercises by ourselves. However, the whole lecture was a little fast today and, thus, a little harder to follow than the last two lectures
- Good course. I learn lot about Matlab. I was able to follow exercises. When I was lost I copied the answer from SW Carpentery web site.
Day 4
Icebreaker
how are you feeling today? Did you have time to try Matlab Onramp from https://matlabacademy.mathworks.com/?
- Yes. The exercises take longer than what I tought. Tough good practice.
- Feeling good today :-) I finished onramp and started with matlab fundamentals (I stopped before the 3D figures)
- another one
- Feelin okay and I am still on Matlab Onramp. At the moment am at 61%.
- Feeling a bit tired but ready for today. Had a chance to start Matlab Onramp.
- Same here, but didn't have time to try Onramp
- Onramp 61% completed. feeling busy but OK.
- .
Code for today at https://version.aalto.fi/gitlab/eglerean/matlabcourse/-/tree/master/AY20202021%2FMatlabBasics2020%2Fsrc
Feedback about today and about the whole course
Write something positive and something that could be improved
- A good compact course that dives to the basics of Matlab.
- Today you had a very smooth connection! Very good compact introduction to Matlab. It felt really nice being guided through the material step by step. I feel much more positive about learning more Matlab. Thank you very much for your work.
- Good Matlab tutorial. Thanks for your work.
- Overall: the course was very good structured and easy to follow. Thanks a lot!
- Excellent structure that covered everything from very basics to basics of advanced Matlab coding. Maybe in the future you could organise courses for specific groups, like biologists, neuroscientists etc. Other take would be to focus on specific type of analysis, such as image recognition, machine learning etc.
- Very detailed course and helpful.
- This course is useful even for peolpe who master Matlab, as the teacher explains some concepts that are useful in genaral.
- I like how the teacher is flexible and cares most about learning and technical course outcome.
- It is a very useful course and it has been an interesting one, Touches mostly everything one needs to know for a basic course.
- Today's explanation about data plotting was nice.
- Good communication between the instructor and the audience.
Always write above this line. We go through questions and comments