Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
a more detailed example for writing a plotting script #95
Under the heading 'Writing MATLAB Scripts', given that we are focusing of software/data carpentry, I feel it is essential we include a more detailed example for plotting data. While the current example takes the user through the very basics of plotting in MATLAB, instructions on how to co-plot data, specify line styles, and basic manipulation of other plotting parameters will be very useful.
An example code that can introduce the above mentioned concepts using data from 'inflammation-01.csv' is given below:
% script analyze.m
patient_data = csvread('inflammation-01.csv');
disp(['Maximum inflammation: ', num2str(max(patient_data(:)))]);
ave_inflammation = mean(patient_data, 1);
%% Find the number of rows
% Plot data
% Label axis
% Scale axis
% save plot to disk as png image:
At minimum we will need to include information about what exactly each function in the above script is doing. Without this, both learners and instructors will be confused. I think that this addition would add a lot of (useful, but not essential) detail to the lesson.
I think it would be great to have the axes labelled. There is some of this in later episodes, but I think it would be good to introduce it a bit earlier. Perhaps a little pointer to the documentation could replace some of the more involved formatting suggestions above?