Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ep. 3 Match code block output to input #234

Open
ChucklesOnGitHub opened this issue Aug 26, 2021 · 1 comment
Open

Ep. 3 Match code block output to input #234

ChucklesOnGitHub opened this issue Aug 26, 2021 · 1 comment

Comments

@ChucklesOnGitHub
Copy link
Contributor

In the episode,
https://github.com/swcarpentry/matlab-novice-inflammation/edit/gh-pages/_episodes/03-plotting.md

in the third Matlab input:

disp('Maximum inflammation:)
disp(max(patient_data(:)))

the students would not actually see the output as displayed in the materials:
Maximum inflammation:
20

But rather, sequential outputs because we are using the command window:

disp('Maximum inflammation:')
Maximum inflammation:
disp(max(patient_data(:)))
20

Since we haven't introduced the editor and scripting at this point, maybe a solution is concatenanting arrays as done in previous episodes even if it is somewhat lengthy and nested.

disp( ['Maximum inflammation: ' , num2str(max(patient_data(:))) ] )

Or alternatively, but not necessarily advisable, on the same line:

disp('Maximum inflammation:'); disp(max(patient_data(:)));

In any case, the block of input commands (max, min, std) and its actual output should be matched.

@gcapes
Copy link
Contributor

gcapes commented Aug 27, 2021

Thanks for the issue. You're right they don't match exactly. While this would only be a potential problem to those following the notes rather than an instructor, we should fix this.

I'm wondering what the best solution would be. I like your idea of two commands on the same line separated by semi-colons. I'm also thinking whether it would be easiest to use double quotes which would mean strings instead of character arrays. So we could do something like this:
disp("Maximum inflammation: " + num2str(max(patient_data(:))))

This would require some rewriting of episode 1 too.

Or, do we really need to cover printing of output like this? It's not one of the learning objectives in either episode, and is rather fiddly/clumsy in MATLAB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants