This is the solution to Quiz 5: Problems - MATLAB IO and plotting.
This quiz is about methods of IO and plotting in MATLAB.
1. Write a MATLAB script, named plotGrowthRate.m
, that reads this chain.txt file, and then makes a plot of the fourth column of data (GrowthRate) in this file, that looks like the following,

Use whatever MATLAB IO method that you prefer, in order to read the data. Save the plot with the name GrowthRate.png
.
Answer:
Here is a possible implementation: plotGrowthRate.m.
2. Write a MATLAB script named, robustWebRead.m
that takes an input string containing a web address, then checks if the web address exists or not, if it exists, it returns the content of the web page as the output of the function,
>> d = robustWebRead('https://apod.nasa.gov/apod/image/1711/M33Nagy_tamed.jpg');
Reading data from the web address...
Done.
>> imshow(d)
>>
>> robustWebRead('Chicken or egg? which came first? This is the question')
Reading data from the web address...
Warning: The requested web address does not exist! Gracefully exiting...
> In robustWebRead (line 7)
ans =
[]
>>
otherwise prints a message like the following and exits the function without breaking the MATLAB (e.g., without any abrupt stop).
Answer:
Here is a possible implementation: robustWebRead.m.
3. What is the difference between gca
and gcf
keywords in MATLAB? (what does each one do?)
Answer:
The term gca
is a MATLAB keyword that refers to the current active plot in the current active figure. By contrast, gcf
refers to the current active figure handle.