 okay recording started okay so i don't know if thomas if you also want to record for whatever backup purposes excellent thanks all right so basically the first thing that we will cover is the teaching material so the course that we follow is programming with matlab come the software carpentry the software carpentry is an amazing project where multiple teachers and people who want to teach programming but it's not just programming there's also carpentries about data management and many other things they basically gather together to write teaching materials that can be reused by everyone and this makes total sense just i don't see much point in creating always new materials and always different slides and always you know you understand better than me that then you can also go somewhere else and tell yes i've done the the software carpentry matlab course and then the new person that you meet knows what you've done and what are your your level of knowledge so the software carpentry link is already in your email and it's also in the hack and d if you scroll at the top and now i'm in the first page of the hack and d of the sorry of the software carpentry course so in general what is interesting with this approach of teaching is that rather than you know going through the syntax of the matlab language is good to have a problem is good to really learn with the data problem and in this specific case the the goal of this software carpentry matlab course is to be able to load different type of data which in this specific case are about some patience the data are stored in a common separated value format which basically mean the year rows and columns and we will check later how they what they are the rows and what the columns are and then the goal is that we want to be able to load this data this this data into memory we want to be able to calculate the average inflammation per day across all patients and also we want to be able to do some plotting so this is kind of a very common workflow in many data science project that you need to load some data do some processing and then make some figures that will end up on your scientific paper so there is a prerequisite for this course is that you need to download the files for the lessons so if you all open this page that i'm showing here and for your convenience i can also paste it in the zoom chat but it's also in the hack and so from there you can click to the on the setup on the schedule and here you will get a link to the zip archive where basically the data are stored so you should be able to download this zip unzip it and then basically go with matlab to this folder and i will show this so don't worry then so basically this is about the teaching material then the first thing that we basically need to familiarize yourself is matlab meaning the matlab integrated desktop environment or integrated developer environment so now i'm gonna make my matlab full window and hopefully right now you are also able to start matlab and see something similar that i'm seeing so if you are not seeing the same for whatever reason you can click on this layout button and here there are different layouts if this is the first time that you start matlab you should be able to see the default layout which is what i'm having right now but of course there are other layouts so for example there is a three column layout and and so on for only the common window now i'm gonna stay switch to the default layout and explain these multiple windows so the common window this is basically for those of you who are familiar with the terminal the common window the common window is like a program or the terminal is like a program that is like the smallest problem that you can run on a machine that lets you interact with the machine so in a terminal in a common window we are able to type commands and then when we press enter the machine interprets our command and gives us something so for example the most common command now that i'm in this common window i could ask what types of files are there so i could type the command ls and here i get a list of the files that are in the folder where i am right now so if you are familiar with linux and windows and sorry linux and mat this is basically what you know already but in general i hope you might have heard earlier but so in general what i want to say is that the common window is like the most basic way to interact with matlab where you can interactively type some commands like ls to list or dir which is kind of a similar to ls and get some some immediate output in this case the files where i am but of course there are other sub windows in this view and another view here is the current folder which basically is the folder where i am right now you also see the path here on top so right now i'm in the folder z documents matlab and if i'm not sure where i am there is actually the matlab command pwd you can also try pwd on your matlab then i press enter any games in this answer which is yes i'm in z documents matlab you might have a different path of course depends on your installation on your operating system but basically this is where you are and this is why when i type the command ls which means basically list i get all the files that i also see here in the current folder there's also these two special files the dot and the two dots so dot means the folder where i am and double dot is the parent parent folder then here in the same in this default layout there is also a sub window called details this is this will be interesting later it's something that you can select one of the files and if there are some details it can give you some details so specifically the files that i have here have no details but i will show you later why this details is useful and then we also have the workspace so the idea is this if you this is kind of basics of of computer science so if the current folder kind of points to your physical physical device to your to the disk of your of your computer which is basically um sorted or or arranged as a as a tree so you know i pick the tree which is called z and then i go to the branch documents and i go to the branch matlab this is how folders are stored however in a machine in a computer there is also stored something in the memory which is not the disk which is not something that is physically stored on the somewhere like files but it's temporary stored in the in the memory so the workspace here is basically what we what we keep in memory right now which variables and soon we will introduce the concept of variables so this is the matlab interface but of course there's many other buttons here on top we don't have time to go through all the buttons and through all the settings but um you will see how i use them that sometimes they can be useful and then later next we have another course which is matlab advanced that we all usually run in may so if you also want to join us in matlab advanced you can see things like for example timing the course profiling the course and using some of these more advanced features okay so now as i said earlier because of the screen and because it's nice that you also try the same things i'm gonna switch the layout with this button to common window only and make my matlab window vertical so that on the left hand side you see my common window and in the right hand side you see the learning material from the software carpet all right so the first thing that we will learn is about working with variables actually maybe first let's maybe before starting with the actually carpentry material i think it would be good to mention also talk something about the self-learning with matlab so there are different ways of self-learning and self-helping and i mentioned already in the email and i hope you all created an account to matlab academy website so the matlab academy let's have a demo of the matlab academy because this is very useful so maybe just a quick poll with zoom how many of you like can you all log into matlab academy and let's see how many thumbs up or whatever it's used in this case four months so can you please now log into matlab academy and see if you see a view similar to what i'm seeing and then if you see it you can express your agreement with the thumb up or green mark or whatever zoom allows you i see one thumb up two okay this is good especially if you're planning to do to to get the credit it's good that you test now this matlab academy because then you know you can you know that it works you know that you're able to look in as i mentioned in the in the email it's good to register in matlab academy using your institutional email address because your institution might be covering other courses that are not part of the default matlab installation so the first basic course that is in matlab academy is matlab on ramp now if you you can do you can follow what i'm doing zoom but it would be great if you can do the same who i view listen to me so matlab on ramp is like the most basic matlab and basically what we cover here in our software carpet the course is exactly matlab on ramp we talk about desktop and the editor the comments what we already covered and then we will talk about vectors and matrices arrays calling functions basically everything that you see here is also covered by the course today but of course if you don't have time to take the course or if you're learning style it's more like if you feel that learning interactively it's something like matlab on ramp it's more helpful then i mean you're welcome to to to learn through matlab on ramp so now here i click on resume course and basically now start the matlab on ramp and make sure that i go to the beginning because i think yeah so the first thing that it shows is a is a video we don't need to if i can stop it we don't need to look at the video but it's basically what i just told you you can look at the video later if you plan of taking it and here i want to show you how the matlab on ramp interface works so the idea is that we still have like it's like that we have now the matlab matlab terminal the matlab command window it's just that now it's running inside the web browser you see now this is my chrome window this is the you know so now matlab this is not my matlab but this is like a virtual matlab that is running on the web browser and then here you will have a task so for example here the first task will be multiply the numbers three and five together in the command so i go to the command the terminal window and i type three times five now we should expect that the answer is 15 i press enter and yes the answer is 15 and yes we can now press space to continue to the next task or ask if i want to try an alternate solution of course this is very simple and trivial and this is nothing so complicated but if you do more of this task if you go especially for the homeworks where there is this it's not going to be matlab on ramp for the homework but it's this fact matlab fundamentals sometimes the solution might not be trivial and so you can also have a look at the solution here which is basically means what you should have typed in the command window to get the correct answer so then i can press continue and now we have another task so for example you know they are asking us assign the three times five calculation to a variable we haven't already mentioned what variables are but we can see that basically they ask us to type something like m equal three times five if i would do a mistake let's say the right type n equals three times seven i press enter and then the matlab on ramp the matlab academy tool is basically telling us yes you did a mistake and report please check your check what you typed or have a look at the solution so you can understand that this is also a very fun way to learn maybe more fun more i'm gonna say funnier than sitting for many hours on a zoom course but the idea is exactly this that you can you know interactively type things get an immediate feedback and by doing all the tasks hopefully learn as much as you can in general now exit of course all the courses in matlab academy i found them very useful and there are for example deep learning on lamp or ramp that is very well done machine learning or ramp if some of you are into these things but as i mentioned earlier you must register with your institution email address because your university in my case auto is paying for some of these courses otherwise i think in the default um in the default courses you only have access to matlab on ramp and matlab fundamentals if i'm not wrong matlab fundamentals is the one that we basically recommend if you want to get the credit and so here it's uh it's basically similar to what we cover but it goes a little bit deeper there a bit more exercises for for for doing this type of work then and when i mentioned another thing about self-learning matlab that there's of course the matlab documentation which is very helpful i can paste this link on the zoom chat and the documentation is really helpful because you know some people don't like to learn interactively and some people don't like to learn sitting in a zoom so another way of learning is to you know read the manual so by just getting started with matlab here there's many for every section that you click i don't know why it wants me to send to the united states when i'm in the notebook so right so here you get like whether we already cover the basics of the desktop environment so we already done this together we already done this together and then similar things that we started soon so another good way of self-learning matlab is to basically read the manual and then another the last thing that i will mention for self-learning matlab or asking for help but you can also ask for help from the matlab window itself so now this is my matlab command let me go back to the vertical screen so in the matlab command we you remember that i typed the command ls to get a list of the files in the folder where i am if i'm not sure i can always type help ls and so the common help followed by the name of the function for the matlab command is telling us something a little bit more details of what this command is doing and of course that would say help plot this is the most basic plot command and you see it also in some cases gives you examples so you can immediately copy control c and paste control v and then you you can immediately get the working solution from the from the help itself okay so now it's 1242 and we still have eight minutes before our break maybe let's be to check how can be if there's any question that is important to cover so somebody's having issue we've downloaded the csv but i just managed to solve it and we can paste later the links for python okay i guess that things seem fine and we'll cover in a how can be all right so we still have eight minutes before the break so let's start with introducing the concept of variable so now this is the software carpentry material that i'm pasting into the zoom chat if you need to open it as well and now remind you that on the left hand side there's just my matlab command and on the right hand side that's the that's the software carpentry material i type c and c which is a command that cleans my terminal so now it's nice fresh and clean all right so the first thing that you need to do that you need to learn with matlab is learning about variables the concept of variables if you've been using other programming languages this is you know all familiar to you but some of you have never used this and of course it's also nice to see how matlab is is storing variables in the in the memory so for example here in this example that they have a software carpentry material they would like to create a variable called weight underscore kilogram i type it so that you have enough time to also type it and also typing actually helps the memory rather than copy pasting so here they want to have a new variable called weight underscore kilogram and with the value of 55 now you press enter and you don't know if something happened if something didn't happen there is a way of course to ever look at the workspace if you remember earlier if you are in the default view you actually see the workspace there so if i make my window bigger and i click on layout and i click on default in the workspace now i see that there is a variable with the name weight underscore kilograms and the value is 55 however if we go back to the common window only and the vertical interface there is also the common who who is basically telling me in the in the workspace which variables are stored right now that's the variable answer which is the default variable that we get and weight and some x and y that i did earlier are the clear all to basically clean my workspace and then with the arrow up i see the history of what i typed so the arrow up and arrow down are very useful now i'm typing arrow up and now arrow down and then i see the command that i type weight underscore kilogram equal 55 you can try to type the same commands i'm going hopefully slow enough for you to be able to follow what i'm doing and now so if you have typed this weight underscore kilogram equal 55 and then you type the common who you will see that the variables in your workspace right now are just the weight underscore all the other variables have disappeared because i've written the common clear all it's like clears the whole environment there is another common called who's so it's who with an s at the end the visual a little bit more detail so now it tells us that in my workspace there's this variable here the size you will see later it's one times one miss is just a single number you have to think that these are like matrices you know so this is a matrix with one row and one column and this is how the class meaning that the type how the how can i say how the numbers are stored in memory we don't need to cover this these details but most likely if you've been taking computing or programming courses you came across about different types and things like that all right so what is interesting of course or maybe what is annoying is that when we typed weight underscore kilogram equal 55 with a semi column at the end we didn't see anything we were not sure what was going on so if we type it again but without the semi column at the end we actually get immediately in the screen the output so you can understand already that the semi column the function of the semi column matlab is to suppress what the output would be sometimes you want to see the output like here maybe i want to make sure that the variable weight kilograms equals 55 at some other times if you run many many rows many lines one after each other you don't need to get you know the output of each line so you can kind of suppress the output with this with this semi column then there are other functions to have a look at what's stored inside the variable here for example they mentioned the disk function so disk i say function and we will go better later on what are functions we will also be able to write your own function but the other function is that there is a command the name of the function and then in the round brackets you pass something to the function so this disk function gets as an input the variable name that we have created and in this case produce the output so we also type it disk weight underscore kilogram and then i press enter and now this has displayed that's why it's this the the value of that variable you can type help disk and then you get an idea of what this disk command does so this convex displays the array x etc etc you can read the the command of course you know it's sometimes we need to store numbers but matlab variables can also store matrices after all matlab stands for matrix laboratory and the second you know if you increase now the dimension kind of of the variable that we store the next step would be to store a list which are also is also called an array so now when storing a single number we were writing it weight underscore kilogram equal the number but when we need to store multiple number a list another a we use the square brackets so now we do the same example that we do there so a equal 1 comma 2 comma 3 the space is not required between the commas is more for readability purposes and then i press enter and i get the same output from the kitchen material so now the variable a is not just a single number but it's actually three numbers it's a list it's an array with three numbers and of course you can understand that the same thing can be done with matrices so here the next command that we should type is b equal so b is equal to a and here we get the semicolon again four five and six and now i don't put the semicolon at the end hopefully we are typing the same so now we are creating a matrix now you just we just discovered another function for the semicolon operator then when we were putting at the end of a statement we were suppressing the output but inside the square brackets the semicolon is basically telling us make a new row in the matrix so if a was a row with three columns one two three here in the matrix b you still want to have a and then go to a new row and store the number four five six and this is why the matrix b has this shape of two rows and three columns all right so this is the most basic first steps with matlab it's good to have a break now because it's 12.50 and we can have a break until 13 i will keep an eye on on the how can be but of course it's good to when when it's a break it's good to have a real break so let's get back here at 1 p.m or clock okay it's 1 p.m and um somebody i wrote that question to the i added the question to the how can be as someone asked via email that if you're not from alto and you need to get the credit if you do the exercises you will get it you will get a certificate that then you can give to your studies supervisor or whatever the person is and then you can register the credit into one vcts credit but of course you might want to confirm with the study supervisor if they accept this okay so now we go back to the software carpentry materials so you've got the first ideas of having variables in our environment in our working environment in our workspace and we created a scholar a variable that was only containing a single number we had an array and we also had the matrix so here in the materials earlier we looked at the function disk to display the content there's another function similar which is none to str you don't need to understand what everything is happening like and you don't need to understand what what the whole thing is about but once again none to string is another function that is converting numbers to string so now i could type also none to string a and this will convert or will display the array in the variable a here as a as a string basically it's nice that we are already seeing kind of example how real code is used and by using it we are learning you know when should we use none to string and when should we use this so for example in this other example in this other bit of code the web here we will now like to store the weight in pounds so convert in the kilograms two pounds and so weight underscore pounds equals two times two times the times operator is this star and then weight underscore kilogram and then I type the semicolon also and so now we can run this type of command which is this which we are called earlier is this function and then now what is interesting here is that between square brackets we have a string that is weight in pounds and then none to string so now call me lazy i'm gonna copy and paste it from the documentation but of course it's nice to to type everything so you learn but now what is interesting here is that you see that these square brackets basically mean that what's inside the square bracket is an array so we saw earlier that a is an array of numbers but what it's interesting now here then actually we just created an array of strings where strings in matlab are defined with normal text that you would type between this apostrophe so there's a string weight in pounds and it's basically concatenated with another string that is the value weight underscore pound that was converted from number to string so you get an idea that basically I would say that almost everything matlab or many many types of the variable store are arrays or matrices so when you need to display a string it's basically an array of characters because this is what string is and of course when you need to store numbers you can store them as an array of numbers okay so of course once we define a variable it doesn't need to store that value forever on this specific case here for example we want to assign a new value to the variable weight underscore kilogram so just to refresh our memory and let's see if we type weight underscore kilogram what is the value right now and matlab is telling us that the value is 55 now we type a new value so I type that weight underscore kilogram equals 57.5 and now the variable has a new value however earlier here in this line here we define the weight in pounds equals 2 times 2 the weight in kilogram change in the weight in kilogram does not automatically change the weight in pounds this is because we did not kind of refreshed the content of the variable weight in pound so here let's also written here in the teaching material we just change the value weight kilogram but weight in pound hasn't changed so if we have a look at weight underscore lb this is the old value 121 because the variable itself weight underscore pounds only stores the value it doesn't store the concept of you know being two times two times weight in kilogram all right so well here then in the learning materials they tell us about the who command that we already know about it they don't mention though I find more useful to add the whose with the s because then I get a nice list of the variables they are there and the and the size of this variable so you see here for example b was a matrix with two rows and three columns and and you know and then weight in kilograms and weight in but of course if you if you if you have the full matlab window like I was showing earlier you see also everything in the in the workspace window and then another important common is the common clear where for example you need to get rid of a variable that you don't need anymore because you know that in the next iteration that variable is not supposed to be there so the clear common followed by the name of the variable that you want to get rid of weighting pounds now I press enter and now this if I type whose again we see that the variable weighting pounds has gone from our memory from the workspace so here there's a small exercise that my opinion it's very trivial you don't need to do it but in this exercise we define a variable called mass and a variable called h and then the mass variable gets updated so this is very common in many other programming language that what we have on the left hand side will store the new value and on the right hand side of the equal operator you have the old value so the new value of mass will be the old value of mass times two and the new value of h will be the old value of h 122 minus 20 so of course you are free to run this on your on your matlab and check but the good thing about this software carpenter's material is that you also can pick at the solutions and you get also some comment basically what I just told you about the left hand side and right hand side of the equal operator okay so the goal of this teaching material though was to be able to load some data process the data and then visualize the data so I guess all of you were able to download the zip file containing the data and then you should basically now unzip it so that you can see the content and you can access the content now for me I am I moved this document in the same place where I want my matlab files to be and specifically my settings it's in z documents matlab but of course it might be different in your case and then I unzip the data now if you are then in the same case if you did something similar to what I do what I did with ls you would see that you have the zip file matlab-novice-inflammation.zip and if you unzip it in the same folder where you are right now you also have the subfolder matlab-novice-inflammation so with the terminal window we can actually change directory cd to this matlab-novice-inflammation and now if I type pwd I see that the path where I am in the operating system where I am in the hard disk sorry is in documents matlab matlab-novice-inflammation if this folder here that you unzip is stored in a different location let's say that it's in under your downloads folder then you can do cd and then specify the full path of this location let's say that you have it in c and then download and then matlab-novice whatever is your path so you can basically what I'm asking you now is to go to the same folder that you unzipped wherever that folder is in your operating system so that you are able to type ls and cd to subfolders here so inside that zip the data was stored in the subfolder data and we will use the subfolder results to store the images they will generate from that data here there's a nice box in this material about the good enough practices for scientific completely which links to this paper in I think was it in plus biology well they this is actually a very nice paper I open it quickly because they really you know it's one of those papers that help you be good enough if not the best when it comes about data management as well as code management and just you know don't get creative with your video projects but the a good rule is to keep the data in its own folder and the results in its own folder and the code in another folder so that you think separately and organized and if you win the lottery and disappear someone else can continue from the world because they know how the data is organized and what to expect from from the folder structure all right so now basically what we need to test right now is that we are able to load the data into memory so now we see concept that we are already familiar with we see that now this patient underscore data is the name of the variable and it's on the left hand side of this assignment operator and it's equal so basically we want to have a variable called patient underscore data and this variable should contain the data that is stored inside the file called data underscore sorry data slash inflammation zero one it's basically means that in the folder in the sub folder called data there should be a file called inflammation zero one read matrix is the function that we use to basically pass the name of the file and it will return the values that are stored inside the file so let's type the same command patient underscore data equal read matrix data slash you see I could type everything inflammation etc etc but I'm a bit lazy so I just start typing in and then I press the tab button and matlab tries to autocomplete the string for me so now in this data folder there's actually more than one CSV file that starts with in but in this specific case we want to pick the first one here and so I picked that I double click and now you see matlab basically autocompleted the the full name of the file and then I close the bracket of the function read matrix and add the semicolon operator at the end because I don't need to see I don't want to see the output of this of this data so I press enter in the bottom here you see that it was saying busy the busy would mean that the matlab was doing something in this case opening the file loading the content and moving it into memory into this patient data variable if we didn't put the semicolon operator like they do here in this second command let's see how it would look like so I type now the arrow up arrow up goes back to my history and you see actually the full history of the commands that I've typed but now I don't want to rerun exactly the same command I want to get rid of the semicolon at the end and now as you remember from the beginning by not having the semicolon at the end it means that all the content of the variable patient data will be displayed in the terminal window so let's press enter and now you see yes there's many many numbers which basically is the content of these matrix so because this is a big matrix it takes many rows and many columns and so you see here we have the name of the variable patient score data and then here it starts displaying the actual data so columns from 1 through 12 and here we have the values of the columns if we are unsure how big this matrix is we can of course run our command whose and you see the now patient data is 60 rows and 40 columns but there's another command which is size so size and then the name of the variable which is basically telling us what we also see in words how many rows this matrix and how many columns so well here some comments I'm not going to read through everything you can of course read learning materials by yourself but in general they're basically writing what I was saying earlier that everything that all data is stored in a form of multi-dimensional array we have the numbers and the scalar we have the list of numbers or vectors or arrays and of course we have matrices now in this case for example we have a two-dimensional matrix but you can have three dimensions four dimensions you know you can have all sorts of multi-dimensional arrays as they say here and what is interesting that even characters stream sentences and whatever even those are arrays even those are matrices so then here they also explain some concepts that we didn't really cover earlier the concept of a class now this is a bit familiar for those of you who have learned some other programming language but the idea the simple idea to put it in a simple way is how the data is stored in the computer that you're using so the class is specifying this now you see here with the common hoods that I'm using we get the name of the variable a the size of the variable one row and three columns and also the class of the numbers so these are called double which basically means that this number is stored with double precision if I'm not wrong we say 64 64 bits used for the for the storing of this of this number but of course sometimes we might need to load some data that is not stored as double numbers for example here they mentioned another class called integer 16 so that you know there are different basic ways of storing numbers in matlab as in many other programming languages maybe one notice about now to load this csv data into the variable we've been using this read matrix common this is quite a recent common I think it was introduced in 2020 last year only 2019 I don't remember but if some of you are using in matlab studies a little bit older then read matrix most likely is not going to work but then now I'll use the arrow up to go back to the common so here instead of read matrix you can also just use the common load load is a generic common but tries to understand what is passed to the common in this specific case csv comma separated by d u phi and tries to basically figure out if it can be loaded into memory in this specific case this should work so I press enter and then if I type the variable again it's still or actually maybe if I type size like we did earlier it still looks the same so if read matrix is not working for you you can use load okay now we can move to the second lesson from the software carpentry materials and now we're gonna talk a little bit more about arrays let's have a quick look in how can be there's anything worth mentioning that we missed or some important points and of course Thomas feel free to unmute yourself and comment because I'm trying to keep seeing oh and yeah already here people are discussing that some older version don't have read matrix csv read is another good option for that and I don't see any specific dimension of Thomas if there's anything that we should bring up feel free to unmute yourself and all right but since that we are fine nothing at the moment yeah that's so I hope you also have enough time to type what I'm typing so that you can get the same output and as I see already how can be when you don't get the same output try to understand why you're not getting the same output I guess this is the main advantage of being here together and trying these comments and trying this teaching material rather than you alone doing this by yourself all right so now we're gonna talk a little bit more deeper about arrays you understood what are arrays in specific example here we had a array a where we were storing three numbers so if you still have it in your workspace by typing a you see here it has one two three but of course what is interesting is the so-called array indexing so array indexing you basically mean that out of a long array or out of a long matrix you need to access a specific value so for example you know out of this array I don't need to access all the three numbers I just need to access the last one so in this example here in the teaching material they start by creating an eight and say magic matrix let's do the same so m equals magic of eight I don't press I don't append the semicolon so that we can see that the output is the same that they get and it is magic is a nice function so the function but it's a funny one if you type help magic this function is creating as a call magic matrix you can click here where it says documentation for magic and it will open another window but there's a little bit more explanation of what magic is doing but basically the magic square is a square so that if I recall correctly the sum of the rows is the same across all the rows in our specific case we decided to use magic or in this teaching material they decided to use magic because it's a nice way to generate some random numbers although they're not random to generate some fake data for our purposes and now our goal is that you know okay cool we have this matrix eight and say it containing all sorts of values but we need to access a specific single value out of the matrix so for example here they try to get this value 38 now let's count together in many programming languages when you when you have a matrix or whenever not already you start counting from zero which might not be intuitive if you never done programming before but on the other end there's a good reason for kind of start indexing from zero in many programming languages matlab or webber is special case where the counting starts from one which might be convenient in kind of normal language but you can imagine that it can cause confusion when you try to port some matlab code into python for example where the counting starts from zero but anyway we need to count basically in which row in which column this number 38 they need to get so number 38 is in one two three four it's in your row five and it's in one two three four five six and column six all right so to get access to check that number we need to specify the row and the column that we just got so the variable m and now you see now we don't have any square bracket we have a round bracket so it's it's like this m would be a function of course it's not a function because it's a variable and we call it with these two parameters which is the location of the row and the location of the column so now if I press enter yes you get the number 38 which was indeed that column at row five and column six rows always come first so you can think that the first dimension by default is the dimension of rows and then columns it's the same with matrix algebra basically so an index like five six selects a single element from the our from the array so if you think of the array earlier this is a little bit of a special case because there's just one row and three and three columns we would basically mean that everything is row one and then we want to get column three now you understand that when there's only one row it's a bit useless to specify which row it is and this is why sometimes with one-dimensional array you can just specify the only dimension that exists so a of three here or wherever we have a two-dimensional matrix and now we have another challenge that instead of getting just a single element like we got earlier the row five and column six now we want to get the full on two three four the full column sorry the full row five so of course one could vary like this five and then start typing all the values that you need to get not exactly like this but you get the idea but in macro there is an operator which is called the column operator so not any column but column now the idea of the column operator is basically means give me everything in that dimension so the first dimension was the rows and we say that from the first dimension we want row five and the second dimension there is columns we're saying give me everything so we also type what is there in the teaching material I press enter and yes I get the same the same output so now we basically extracted what you see here in this picture we extracted the row five out of these matrix so the column operator is basically an operator that is telling us give us all elements along that dimension so in this specific case you know we can get the whole row five now here we have another task instead of just getting a single row or a single element like you said at the beginning now we're gonna basically get the so-called slice of this of these matrix we're gonna get the first four row and all the columns of these matrix so the slicing that this column operator can also be used for slicing now now the notation for doing this the common for doing this is one four and then like this I think I don't remember if you're in the teaching material they really expand on this but maybe it's important to have a look at what's going on so this one column four if you type it in the in the terminal without the m without the brackets it gives you a list of integers so this is basically saying that for m and you're giving a list of integers one two three and four it basically means it was the first four columns four rows sorry so what is interesting here is that this column operator can also be useful to create lists now if I would write one column ten I would get the list of integers up to ten and one and if I would type minus ten to ten I would get all the integers go from minus ten to ten so you see that the column operator is also useful not just for slicing that we're doing here but to create quick lists of integers we can see later that you know we don't need to always have kind of a step of one between these numbers but sometimes you want let's say to get all the only the odd numbers or go you know I can kind of spoil the fun already that if we do something like this one so here we are basically saying with the step of five go from number one and until you reach you know do not go over the number one hundred and so here you start seeing the one plus five six plus five eleven etc so closing this digression let's go back at our teaching materials so now we want to get a slice of this matrix from rows one to four and all the columns and we get one again of course the same could be also done with the columns so now here from this matrix we get a different slice we want to have the last three columns and all the rows so now in the dimension of the rows we say everything all the numbers from the first to the last and in the dimension of the columns we want to get six seven and eight so I could write it like this because six two with the column eight it would basically tell us the least six seven and eight but again there's another magic word which is end and in this context the word end is a special word it's a special variable that is telling us go until the last dimension of the matrix n so we don't need to remember that this has eight columns so we can just type end so let's type it and let's see if we get the same and yes we got the same and of course if you don't like and if you really wanted from six to eight independently how big the matrix was you could have written six column eight and you get exactly the same so in this context the the keyword or the special word end the special variable end is automatically replaced with the size because if you type size of n it's actually eight and eight finally we might want to select a sub matrix so instead of getting the all the columns or all the rows like we did earlier here we want to get a little slice of specifically this starts in row four and ends in row six and then starts in column five and ends in column seven and so this is we want to start from row four to row six and then from column five to column seven hopefully i'm going slow enough that you have enough time to type what i'm typing and what we are reading from the learning materials and now you see that yes we get this the same output there we get and the reason is of course once again this column operator because if we extrapolate if we take them out from what is inside the the round brackets so four column six will give us four five six a list for the rows and five column seven gives us the list for the columns which is column five or six and column seven so as i already spoiled the fun earlier sometimes you want to get you know instead of having consecutive columns you might need to or consecutive rows you might need to jump between rows and between the columns so here specifically they want to get the column number two and column number four one two three four sorry and column number five and then column number eight so there's basically a jump the two plus three is five then plus three is eight so once again with the notation like this we can get all the jumps with the jumps of three we can go from the number two to the number eight in our specific case we don't need to write the eight when we are inside the round brackets because makram knows with the operator and that we want to go until the end of that matrix and then when it comes to the columns we want to get all the columns so we use the just the operator column and we press enter and yes we get exactly where we get there then here they are suggesting you know can we get a checker board so now you see that when in the denation of the rows it starts from row one plus three goes to row four plus three goes to row seven and the column starts from column two plus two goes to four plus two goes to six and plus two goes to eight so you can basically write this with this type of jumping so from row one with the jumps of three until the end and from row from column two with jumps of two until the end and basically we get exactly these numbers here which are the number marking blue in these learning materials okay so this then we all do is so-called slicing where we in this specific case we sliced the matrix or we picked what we only wanted to pick from the matrix and of course slicing is the defining tears more appropriated when we talk about the subsection of an artery like you would take a slice of cake so the thing with matter of course is that matlab everything is matrix or an array and of course the slicing can also be done with the string so if you remember what we were saying earlier that the string is another type of is another class but it's basically an array of characters so now in the variable element we write this we want to store in the variable element the string oxygen so if you type it like I'm typing now I'm typing without the semicolon even though in the teaching material everything the semicolon okay now the variable element contains an array of characters we can check with whose and indeed now the variable element is as a size of one and six so one row and six columns and the six columns are six letters which are top type that their class is the class char all right so now we can of course trade this array variable this element like we will be like we were treating them the number matrix the the arrays with numbers so for example here if we want to display the first three characters of the of this variable element we could type element one two three and it would give us oxy so the first three letters of the of the variable of the array stored in the variable element here they actually use the disk common to display a string and the square brackets is to make an array like we were doing earlier so earlier we were typing something like this a equal with the square bracket one two three so an array of numbers but here I'm now going to copy paste it from the learning material here there will be a new array where the first part of the array is something that we typed first three characters and the second part of the array is a subset from the other array called element specifically the first three letters and so we get something like this then they put the disk function around it so now I type a row up and then I want to call thisp and then the round brackets are for calling the disk function so then instead of basically reading ants and this as a string I see a little bit nicer display like this so they will just see the output there and then I could do the same I'm not gonna do it for the for the other characters from four to six so that you get the last three characters of of this variable called element now there's some exercises that maybe you can spend a few minutes to do and write the solution in the HackMD so the first exercise is what is the value of element four to end and what about element that goes from one with steps of two until the end or then element that goes that starts from two until end minus one all right so you can basically try this and then on HackMD like earlier you were writing these icebreakers you speak one row for you and write these three answers for the number one of course I mean this is it's it's fine to spy what other people are answering but it's this is a good moment to actually test things and make sure that you get the same that other people like it and then the second mini exercise is that for any size the very matlab allows us to basically use this column operator to index all the rows and here they're saying compare the element calling just the element with element and all the and all the kind of all the elements of element and then try to do the same again with m and with m using this you know so you would see that the size of element will be different than the size of element with the column or actually with element is going to be the same but with m it's going to be different so let's spend this shouldn't take more than five minutes let's say four minutes so I'm going to put the timer of four minutes and you can go to HackMD and try to write the solutions of these two exercises I know and you know that you can also look at the solutions with the button here but for now you know let's look at the solutions later to get so four minutes starting now okay four minutes have passed yes I want to make one comment because I think it's important to know matlab is a one based programming language so all arrays and all indices start with one in most other programming languages the numbers of arrays or indexes actually start with zero that's just an important information to keep in mind because if you forget about that you can run into very well inconvenient errors or inconvenient situations so just as a remark yeah this is this is very this is an excellent point this is when maybe it would be if matlab if this is your first you know interaction with the programming language and if matlab is the first programming language that you learn how can I say maybe it's not the best language to learn first that it would be good to understand these things with another language and then here you are how can I say adapting what you already know to the perks of matlab I think it's in tomas that only matlab and are as far as I know I'm sure there's other I'm pretty sure there are more but those are the two popular languages in sign in signs and anywhere else that I currently can can yeah think of that are one based everything else is zero based I guess the major danger is that there's other types of danger that with the programming languages like python if you start to access you know if you will type the equivalent of adding the length of the matrix like eight he would throw an error so you actually know that something is wrong but with matlab you know so basically this is an excellent point on that I think it's particularly important if you have code that you want to transfer from one language to another where you can end up with simply wrong code and the worst case a best case it just throws an error worst case it does something that it's not supposed to do yes excellent point so I see you can be that many have tried the exercise or at least you know a decent amount of people and actually you tried it and wrote the solution you know it's not rocket science yet and I'm going to try it myself here so now I just make sure that the variable element I'll press enter so it contains the string obstacle and then the first exercise is to type element that goes from four until the end and yes we get the end on the string then the second exercise element goes from one with steps of two until the end and so we should get O Y E yeah that's correct if I wanted to have it you know so basically now we are getting the numbers one three and five if I would start from index two with steps of two I would get the what are they called even location so would be x j and n but here the last one they ask us to start from number two with the steps of what basically steps of one and then go until the end minus one so let's try it and then two until and minus one and it's basically so starting from the two oxy again so it's it's basically missing the first letter the O and the last letter and I personally like I understand what Matlab is thinking here and I know that he wants to go from the number two until the end of the string minus one so the location what was the size of the string what six I don't know yes six so it's basically saying you know that this is element from two to five you know that we skip the first time we skip the last but imagine if I put everything in like this that's my so you see the kind of how can I say confusion here that like I don't like and minus one I I always prefer to explicitly how can I say explicitly define how things things should should should go so that my point being that I would rather write it like this so that the final number is specified rather than letting Matlab interpret you know in general the point that I'm trying to make here is that having extra brackets to define the order of the operator doesn't hurt improves the readability and make sure that you know what's going on that this is not going from two to end and everything shifted by one but this is going from two to n minus one and then here you already notice the use of the column it basically if you use the column in itself it transforms whatever you have into a single into a single column so with the variable element we will make instead of being a row like it used to be we'll make everything as a column and with the variable m of course we will reshape that's the word reshape the matrix into a single column we're not gonna run it because otherwise I will get a long list of numbers in the macro command but with size you basically get the 64 elements and into a single column if you're curious to see how this reshaping happens let's call a new variable called m reshaped equals m with the column operator without anything else all right now let's have a look at the first 10 elements of this m reshaped and now let's also have a look at m so you see that we basically have the first column intact but then it kind of switches to the second column there are two here 55 etc so basically the way that math library shapes the matrix m is by giving priority to the first dimension so the first dimension is kept intact and then it takes the column two and basically cuts it and puts it under the column one and so on for all the other columns so it's basically going to read all the elements kind of giving the priority to the the first dimension all right I guess the solution here don't expand on anything more than I said so the point for this part is that we have rows and columns with matrices and with this notation we can slice or get bits of indexes and then the column operator was very useful for many things now it's exactly 151 so it's time for a break and let's resume at 14 sharp with the more to the next part on plotting data okay it's two o'clock and now it's the last part for this first day of matlab basics if you see my zoom window I'm gonna briefly go to the full screen with the teaching materials so just to get an idea where we are you downloaded the files in the setup page we understood what matlab how matlab deals with variables and we got an idea of arrays and how to slice arrays and get sub elements of arrays and matrices now we're gonna do some basic plotting which also requires some loading of the data and so now we are at the section three and we will cover this we will cover this today so I now also go briefly with the full window with my matlab and with the default layout so you should be able to see in the current folder so I have it here in the top left and up on my mouse here you should now be able to see the sub folder data and the sub folder results so this means that you were able to unzip the file that was provided in the teaching materials and basically browse to the pass where this data and results sub folders are so if you don't see this in your current folder sub window here in the default layout then it means that you are in the wrong folder I'll notice on hack and dee sometimes when you unzip something it might create you know two nested folders with the same name matlab dash novice dash inflammation so you might just need to go until you basically see the same thing that you see here you can also check that you are in the right place by tapping the command pwd and so in my case this is the path that I get and then with the command here you should basically see this the current folder the parent folder these are the dots and then the sub folder data and the sub folder results this is important because the commands that we will run are basically looking for data that is inside the sub folder data and so if we will run the same commands in another sub folder in another location our hard disk it wouldn't be able to to find the file and then you will get an error like you know unable to unable to load it all right but I go back to the layout where I'm showing only the command window and again I'm using the left part of the screen for my matlab command and the other side for the learning materials so you can decide where you want to put your matlab command window maybe one before we start I'm actually not the biggest fan of typing commands like we are typing here I rather do things using an editor but maybe we will talk about the editor on Wednesday so for now let's keep in typing interactive command but the idea is you can see that you know okay it's nice to type commands and get something out of it but then tomorrow I might not remember what I was doing or worse in a month or in a year you know tomorrow it's still easy because I can still with the arrow up I can still look at the history window and I see at which point I was but already already in one month I might not be able to remember what I was doing so using with the editor if you already want to type editor or just edit sorry in the in the matlab window it's basically the year you would type all the commands that you want to type in the in the terminal but you can type them so that they are saved into a so-called matlab script but maybe let's not worry about this right now we can talk about editor and matlab script first thing on Wednesday but now let's continue with our goal here and if you remember the goal of this learning materials was to load some data and then do something with the data so for example compute the mean meaning the arithmetic the average of the numbers that are stored in the data so let's see if I already have it in my workspace so I type who's and I still have it but if in case you reset it in case you clear your workspace and you don't have this variable anymore you can start typing the initial and then with the arrow up it basically looks in your history and if you did this earlier this is how you load the data for 01 it's like the first trial you can think that these are like clinical trials so this is the first clinical trial and for this inflammation for these patients that they're testing some drug and then you press enter and again you have the patient data loaded in your in your workspace so to be to make sure that you can run mean so the average of patient data you need to have patient data in your workspace so double check it and yes I have it and the size should be 60 times 40 so 60 rows and 40 columns in this specific case in this type of data 60 are the number of patients which means every row is a patient and 40 if I recall correctly are the number of days so that they follow the level of inflammation of this patient for 40 days right so if we if we type what it's written there so mean is a function that computes the mean of the numbers that are passed so maybe let's have a quick look at what it does with the help and then the name of the function mean and here you get the detailed help that mean is the mean value of the elements that are passed here so in this specific case to the function mean the input is the patient underscore data variable but with the column which means that the whole matrix 60 times 40 is reshaped into a single column you should remember earlier we can verify it with size patient underscore data then just the column operator so yes now we are 2014 sorry 2400 elements into a single column 2400 because the size of this data is 60 times 40 which is 2400 so basically if we type what they are writing there in the teaching material patient underscore data of everything this is like the global average so this is the average of all the days and all the patients and this number doesn't really matter what what is the unit of this number this is just you know to get us to make us play with some data so you know maybe this is informative I don't know but specifically you know we might we might want to get the mean for example across every day or the mean for each patient independently from the other patients so here yeah here they type help me like we did already and so here we can also get of course other functions not just the mean so useful functions to get an idea so called the strict descriptive statistic of a dataset we could have a look at the maximum or at the minimum so you see here in this bit of code here where they try to display for example the output of maximum of everything there and the output of minimum and also the standard deviation so it's basically the same now I typed arrow up to get the previous one but now instead of mean I could type max which gives me you know the maximum value across all days and across all patients and then with mean I would get the minimum value which is zero once again this is the minimum across all days and those patients and then STD for the standard deviation which is four six one four eight so yes I get the same that I got there the difference of course is that here they use the disk function which makes a nice output as you see here the output in the Gucci material so that you know it's useful like imagine that this series of command could be in a script so that every time you write the script you get this nice output rather than interactively typing all right but then as we said earlier when we analyze data we often want to look at parts of statistics not just at the global average or global maximum so we want to for example look at the values only for a specific page so here this is gonna be the slow way of doing it with manually select patient one because we are 60 patient and 40 days so with this we're gonna type it so there you have some time to type it so if I type patient underscore one equal patient underscore data one there's any column sorry so now we are selecting row one which means patient one and all the values all the days for the patient all right so these are the 40 values for this patient we can already look at the values ourselves that it starts at zero then it starts to increase a bit it looks like the biggest number is 18 towards the middle here and then it goes back again to zero so here for example we can look at the maximum let's do it like they did here with the disk so that the output is a little bit nicer so this max and the variable is called patient underscore one and I press enter and I get 18 which is also what I get here of course you know we don't really need this extra variable now we define a new variable called patient underscore one but we could have just immediately passed to the function max the you know the slice that you wouldn't need meaning row number one so we could have written how they wrote it here so max and then the variable we use the whole dataset but we select row one and please give us all the columns and you get the same number 18 so so what we were doing earlier and what we're doing here is that of course we were computing the maximum across all the values that we are passing but it's a little bit more interesting if we could get for example the maximum across all patients for each day or the maximum across all days for each patient so for example let's have a look at this at this picture here so in this case they will do the average across the first dimension now you remember that the rows were patients and the columns were days so if we do the average across the first dimension it would mean for day one across all patients what would be average so kind of the group average for day one and then we repeat it for day two and day three etc or then we might not care about the average the daily average maybe we care more about the single patient data but then we need to move on the second dimension across the second dimension so that the mean needs to operate kind of like we did there we fixed patient one and we do the average across all days for patient one and patient two and so on so to do this with matrap it would be very slow if you know we need to always define a new variable call it patient on the score one patient on the score two etc you can understand that it's will be unsustainable but there is a quick way to do this so the mean actually takes a second parameter so what basically this means the mean is a function a matrap function that and then between the brown brackets here we write the parameters that this function takes the input if we only write it with just one parameter like we did earlier it will return the mean across the first dimension but we can also tell sometimes that we don't want the mean across the first dimension here sometimes we want across the second dimension of course you don't need to remember this by heart this is why it's always useful to type help mean and then you know basically check okay what was what does mean one and then you see that when mean is called with two parameters the first one is the data is the matrix when you're passing and the second one can be the dimension you know that you want like basically you see in this picture with the rows and the columns okay so now if we type then mean of our data across the first dimension now it would basically do the mean across all patients for each day so we should end up with 40 values which is the kind of daily average across all the patients for this trial now I press enter and yes we get numbers that go from columns one to columns 40 so 40 numbers with these average values and these are the same or as same as possible you see that there's some rounding differences here with the data that you get from this from this course but then of course sometimes as we know the mean function instead of having the average across the first dimension we might want to have the average across the second dimension because each individual patient maybe the information is more important than than each individual day so then we can use this so I go with the arrow up and instead of having one as the second parameter I type the number two and now we get this basically the average across all the patients or for each patient the average across all the days and now of course in this case if I look at the size of the mean of the patient data across the second dimension there should be 60 yes we have 60 rows because we have 60 patients and here this is what we exactly did so we have 60 rows and 60 patients all right so now we did some very simple processing I know that maybe in your field we might do much more advanced processing but looking at the minimum and the maximum and the mean of the data here is like you know always with independently of whatever field of science you're working with so another good way of getting an idea of what's in your data is of course plotting the data looking at means and average numbers might be a bit difficult to get an idea what's in the data so now we do the most simple type of plotting that we can do with this type of data which is two-dimensional methods so here we do a so-called hit map and hopefully you are able to run the same and the hit map is done with this function called image sc where sc stands for scale if you're curious about the function you can always type help image sc and basically this plays an image with scaled colors because this is what it does the scaling means that it kind of tries to make sure that you cover all the range of the data that you all the range of the numbers that you have in your data so that you can visualize the full data so let's try together image sc by asian underscore data and let's press enter and now you should have this you should see basically a plot that is identical to the one in the teaching materials we still miss the title and the labels because they're very important always label your axis so we can do it with some with some other commands so matlab has the common title so title and we call it data for trial one i'm inventing the title you can put what you want and now this command here title with the string it just gives that string as a kind of a title for that image then we need to give some labels for the axis so in the x meaning from left to right we have days and so i give x label and then i pass to the x label function base the string base and you see now in the image that we get days and then in the y label we would map passions both from one to sixty or the sixty patient and then i press enter and now we are patient i personally don't think that we have done here and i'm sorry that the people who prepare this teaching material they didn't think of this but i think it's also very important to know the value of the numbers that we are seeing all right in this case we don't really know what they measure but you know in your field you know if you are dealing with kilograms or wind meters or whatever is a unit so when it comes to this type of it max if you type color bar that gives you basically the mapping to read these values so that you know that the very bright yellow gives you you know if in this location the very bright yellow corresponds to a value of 20 and that very dark blue will have a you know a value of zero so that basically you can now read the data and know that yes since it's kind of increasing for each patient from zero to 20 for some patient a little bit smaller and kind of on the day around the day 20 years and sort of a maximum and then it goes down back to the level zero so all right basically here they just write what i just told you and now of course we want to also have some other plot because now with this image sc we have an idea of the old dataset across all the age and across all patients but now we want to have a look at what we already see with our eyes for example that the daily average is kind of increasing in the middle and then going down again so if you remember that earlier we were typing mean of patient underscore data across the first dimension which basically means across all subjects and this was giving us 40 values for the 40 days i press enter and yes 40 values now i can just call another function the function plot that will get this as a input so now this function plot gets as an input mean of patient data around the first dimension now i press enter and i get the same picture that they also get and you should also get the same pictures once again we did not label our axis and it's always important to label our axis never say anything if the axis are not labeled so we first type of daily average across patients then we can give it an x x label it's days and the y label is average inflammation whatever is the actual measure unit that they use in this and now you have a picture you know that there's axis and there's everything and you know that now you you are visualizing the daily average across all across all patients um right so i don't see anything dark and d or i see something but hopefully people are getting their help now in this um plotting that we want to do we also want to get an idea of what is the maximum for example across the days and what would be the meaning so if you see my mouse on this plot it's actually interesting that with matlab we have a recent matter of the previous one if you move the mouse on top of the plot you can get some insights on the data so for example now i stopped in this x equal to seven so on the seventh and the average is 3.8 and then i move the mouse to the top here so it's day 21 and the average is 13 of course you can imagine that this is just the average value i could have another plot which could look at the maximum across all patients for each day or look at the minimum across all patients for each day and this is exactly what they do in the next and the next example here so you notice that every time i'm closing the window and this is so that matlab will basically create a new window and get rid of the previous data this is the usual behavior of matlab but we can check later if there's time one can actually kind of hold the content of the window that you see and plot stuff on top of the window but now let's keep it simple i closed the window and now we try to plot the maximum across all the patients for each day so now you see that would mean we were just we just needed to call pass the matrix of the data and then the dimension but max has a little bit different notation so if i ever looked at the help of max basically the dimension should be specified as a second parameter the actual second parameter of this max function if you need the max between two numbers between two elements you know that if i would call it with max and one and four now i would give me the maximum between these two elements but here in our specific case we don't have a second element to compare and this is why the max function is called with this empty empty array which is just two two square brackets and this is you see it also in the help of the max function but if you need to go along a specific dimension you pass all your data empty array and then the dimension that you want to so in this case you want to have a plot of the maximum of patient data you don't have a second input for max but we have a third input which is the first dimension i close the round brackets for the max function i close the round bracket for the plot i press enter and now we get something like that once again we should have we should have a label for our axis i'm too lazy so i go arrow up and i reduce the same labels that i packed earlier well except even now the y label is not average inflammation but it would be maximum maximum inflammation so now here we know that you know for day five it's use our mouse for days five across all patient the maximum level of inflammation is four all right and then we could do the same of course using the minimum also the mean function is like the max function where the second parameter is not needed if you don't have a value to compare and so because of that it's called in a similar fashion now i try something a little bit more advanced than what is shown in the teaching material because now i would like to actually plot this minimum inflammation on top of this maximum inflammation so i'm gonna type hold on which is an instruction that matter is now telling to figure one please the next type command don't delete everything keep what you have there and put something on top now i type hold on and then instead of plotting the maximum i add plotting of the minimum and now you see now i i get in the same figure this starts to become more informal material and easier to read that this is kind of like in the space between the blue curve and the what is that red that is basically where my data is living so for every day we know what is the maximum and we know the minimum we can actually scroll back up and find where we call the mean and now in the same figure we have the maximum across some days the minimum across some days and the average so now we get the kind of a good descriptive statistic for our for our goal in some cases it's useful to have them overlap like this but in some other cases you might like it might be more clear that things are not overlapping because maybe you have lots of different data and you know they don't share maybe the same axis like here that all the data shared is so we can never look at how kind of arrange the plots later but it would be good if now you spend a few minutes trying these simple exercises and so the first exercise I'm saying here when we plot just one variable using plot example plot of some vector what do the x value represent so you can answer again the how can be and then the second exercise would be why are the vertical lines in our plot of the minimum inflammation per day not perfectly vertical so they're talking about this line here you see that from the line the location x16 then it jumps to 18 so you know and 17 so you can think why the lines are not exactly like a step and then last food for thought is you should try to create a plot showing the standard deviation of the inflammation data for each day across all patients or something similar but instead of calling the function max or the function mean or or mean you should call the function std and you might want to check the definition for the function of the standard variation so I know that this exercise might take some time but it's okay if you are able to do some of it and write on how can be I'm gonna consider I'm gonna give five minutes but maybe we can give we can be interactive let's I will switch on again the microphone in five minutes and then if people want more time to try these things they can ask for more so now it's 1429 we can go we can continue until 1435 I guess which my microphone again okay so we got five minutes I don't know if you need more time to think about these things or I guess we can also slowly talk through and you can still try but the first question here is when we plot just one variable what do the x values represent so basically you have to think that the values are the vectors that we are plotting the arrays so I'm inventing let's see if we still have the array a that we added at the beginning a equal one two three yes so if I would plot a I would just get these three numbers now plot alone it's a little bit difficult to show to understand that the numbers that are plotted here are actually just these three values here one could argue that you know that we have all sorts of the values from one to three so there are actually lots of useful other things that we can pass to the plot function and for example now with these strings here with the star and with the line I'm actually specifying you know what the values in this array these three values can you also put a star on them so that I know that I see the actual data and not this interpolation this linear interpolation that is between them so by doing that now I see that you know there are three actual values and that they are stored basically this x is the index number so in the index one I have number one in the index two number two etc let's try something a little bit more complex so if you think if you remember we called mean of patient data let's store it in a variable so now I define a variable called mean underscore patient when I'm storing the mean and now I can call the plot function hit mean underscore patient and I'm also passing this star and this line so this picture is much clearer than the picture that they were showing us in the in the teaching material because now I know that the actual data points are just the stars and the things in the middle is just you know connected dots which in this case it's the most simple interpolation which is the nearest kind of the line between the two neighbors but of course you can imagine that sometimes you want to have fancier interpolation well not fancier but you know consider that maybe you don't you you you won't have some sort of average across multiple days this goes beyond this basic matra this is something that we cover in matra advanced but now this picture is much much more clear and now this picture is basically answering to all the questions in this problem here because now we can understand why you know the numbers in the minimum does do not jump as a as a step but they but they have always a slope like they they say here in the in the second question so so let's have a plot of the minimum so this was the common thing we had earlier but now to make things clear I also have this star and line which basically for the function plot I'm passing you know I'm telling use the star to mark the actual data points and line to connect to connect the dots to connect the stars and now here it's clear why we don't have vertical lines because one dot is in location let me check this is in location 12 so in the index 12 and the value is 2 and the next one it's in the index 13 so you understand you see that you know if we would need to have a vertical line it would it would basically need that on the same index there would be two values that you know where it would go when it's an index 12 with the value 2 and still in the index 12 or kind of in the x 12 with a value 3 so now of course this is very simple now plot is called with only one parameter one data meaning one array in this case the plot can actually accept more parameters I find it very useful myself to then explore what would be the options that I could use plot and this is how you basically learn in the end how to do plot you're not gonna learn it with this teaching material here so what we can do is for example I now maximize the browser window you can just search for matlab plot and most likely if not always the first so answer is the help function from matlab and here you see the syntax of the common plot this where what I also find useful in the documentation yes is the fact that there are example that one can immediately try so for example here you know you see that they call the plot not just with the y not just with one number like we were calling here but with an x and a y so now you can get a little bit different story because you can specify the axis we don't need to be the indexes like we had in our picture and in this specific case they make x to go from zero to two the value of y so the full circle with a specific step that it doesn't have to be integer so you see that already with what you learned today you cannot you're already able to read that x is a vector is an array that goes from zero to two pi with jumps of pi divided by 100 and then y is the function sin the sinus curve of the values that are stored in x and then when plot is called with x and y now we can actually let's run the same command so I'm literally copy pasting it here but now in the plot I could actually also add this star and this line so I'm basically asking Matlab can you also show me where the actual points are not just the interpolation and yeah I guess I lost it because it's behind the windows but I do like this and now you see compared to the example they have there in the in the Matlab documentation now we see that there are actually all the stars all the actual data points here with the window you can actually you can also zoom in and for example select a small interval and you basically see all the you know the actual values there are the ones in the star and the interpolation that is there are the lines okay but let's go back to our cases so this basically has answer to question two and then the question three want us to plot and instead of plotting the minimum or the maximum we would like to see the standard deviation so it's good to check what this standard deviation function was so I'm typing help standard deviation and here I can already see that dim cannot be the second parameter like we are doing but it has to be the last parameter so then I start wondering okay what is this second parameter doing so the second parameter normalizes and produced blah blah blah so it looks like that if the second parameter is zero this is the same as calling standard deviation without any parameter all right so it's clear that what I need to do is then something like that so let me go back so it's something like here like we did for the minimum but now this second parameter should be zero and the last parameter is to the dimensions so in this case it goes along the first dimension and so basically this is the standard deviation for the patient data across the first dimension so we have 40 days and the standard deviation across the subs if you wanted to have across the patients or across the days by fixing the patients we would have have 60 values like this now you understand also that because those days were consecutive days it kind of made sense to plot them as a time series but these now you know if you care about data visualization one could say that this is wrong because these are just patients there's no need to connect the patients the patient whatever n minus one has nothing to do with the patient and so then one could actually get rid of the lines and just plot the data for the patients so now here we would have that these are patients that go from one to 60 and then kind of the the cloud of all the data points for each patient I remove basically the lines in the plot command because in this case this is not a time series and there is no kind of logical reason to connect neighboring dots neighboring stops okay so one last thing before we leave is the fact that often when you look at scientific publications you might have it in the same figure you know you don't have a single figure let's say here this was the maximum and this was the minimum you might want to combine multiple plots like we did here into the same into the same figure and this is done with the common subplot so let's try the common here I close all the windows to make sure that I don't have anything open so the idea here is that when I call subplot then my subplot wants to have I basically need to tell you how many plots are inside this or how many subplots are inside the figure that I'm creating and this figure specifically has one row of plots and two columns of plots so that basically I'm saying that you know this figure here has one row of plots and there's two plots inside two columns of plots so I say one row two columns and then I pick location one so start from the first plot so basically what happened now is that I'm telling matlab can you prepare a figure that will have two subplots in one row and two columns and start preparing the location one so now matlab made an empty figure as it's ready to accept some plot commands for the first subplot and now the first subplots we want to have the maximum so I'm lazy I use the arrow up and I'm sure it will come up yes here's the maximum all right I present it and now I got the first subplot and of course I need to label I've gained lazy I just start typing the command it's labeled and then I erase arrow up and it finds the completion and then the white label was the maximum and the title it was daily average or actually it was very maximum across pages and then now we are done with the first subplot but we won't have a second subplot so here close to the previous subplot we want to now tell matlab in the second subplot please plot the minimum all right so first we need to tell matlab okay stop using this subplot and switch to the next one so to the second index and now instead of plotting the maximum I'm gonna you see that I don't need to to retype everything with arrow up and arrow down I'm able to find the closest thing and just edit what I need you know I press enter and I gain the labels so it's labels days white label well it's not maximum but it's minimum and the title is daily minimum across pages all right so basically with this simple command calls a plot instead of having many figures for many plots now in kind of into a single figure into basically one figure window inside matlab we can have you know multiple subplots and you know we could have had more if we needed let's say two times two amounts of plots but then this we will cover it in that and on why is there actually okay so the still 10 minutes left which we could use to get some final feedback I don't see any questions enough indeed so hopefully everything was quite clear so for the feedback of the day it's always good to write something positive and something which can be improved this is this I'm trying to be you know if I can say something from the previous years that in general there's some people that are the first time that they might be actually writing code and coding together so being slow has always been doing you know a value for these quotes in the past years but every year you know you are different you're a different audience from every year so you know if you feel that this is too basic that this is too slow this is the moment where you can and you can recommend something which is also important if you think that this is fine you should write it on the on the hack and B because then it means you know that we can adapt for the second day and the teaching materials and as I said in the beginning I'm sticking as much as possible to the teaching materials and the advantage is that you can you know go anywhere and say you've taken that course which is there publicly you don't need to you know it's it's public knowledge what has been learned here but then when I when I think that there's some points where teaching materials could be improved I always try to mention it and show always something a little bit more advanced or clarify some bits here and there so now it's important that you write on hack and B because as usually if you don't vote people will you know decide for something that you did not want I see at least five people right now how can be so please leave your feedback if everything is fine write it anyway which means that also for the second day on Wednesday we can keep a similar rhythm in a similar way but if you want if you have comments it's now the time to just specify it so yeah I guess that's it if you have more questions and comments of course I can be so once they are open I didn't spot anything that is worth mentioning but of course Thomas can also switch on his microphone if there's something to clarify your extent see the hack and B itself in the top on the same hack and B there's also other useful links and there's also a series of Q&A or some frequently asked question that people have asked how specifically you can see that there's already the recordings from last year on YouTube the recordings are very similar enough if not identical so if you know that you will miss Wednesday episode you can easily rewatch it on YouTube it's basically the same and it's what we did last year this is also one that I don't I'm not sure if these recordings this year will go to YouTube as we already have a copy and nothing has really changed as the material is the same but for sure we can share the recording with you here if you find them useful all right let's have a I guess that's fine so if you don't have any other questions or comments you can just go I know stop recording so that you also have a chance to unmute yourself and say something if you wish