==== 1. MATLAB Basic & Variables ====
* Powerpoint: {{ :matlab_training:matlab_basicvariable01.pptx |}}
* Random Function Demo : {{ :matlab_training:rand_func_demo.m |}}
=== Creating Variables ===
* Create a variable called //visual_intensity// and make it equal to 92. Ensure that the assignment result is not shown on the screen.
++++ Solution |
visual_intensity = 92; % The semicolon prevents displaying the result after assignment
% Note that "%" sign indicates a start of a comment
++++
* Create a variable called //simple_text// and assign it value of "A simple text but in Matlab".
++++ Solution |
simple_text = "A simple text but in Matlab";
% Always a good idea to choose clear names for variables. As your code grows larger, those clear names help to remind the logic and context of the code.
++++
=== Using and Displaying Variables ===
* Create two variables called //num_words// and //num_sentences// and assign them values of 6 and 10, respectively. Compute a new variable //long_paragraph// as a multiple of //num_words// and //num_sentences//. Ensure that none of the variable assignments is outputted to the screen.
++++ Solution |
num_words = 6;
num_sentences = 10;
long_paragraph = num_words * num_sentences;
++++
* Display values of //num_words// and //num_sentences// on the screen.
++++ Solution 1|
num_words
num_sentences
% Because no semicolon was placed at the end of variable name, Matlab displays the value of that variable.
++++
++++ Solution 2|
disp(num_words);
disp(num_sentences);
% disp is a built-in function and is a short version of the word display. This function is used to show variable values on the screen.
% When you write a long code, it is a good practice to use disp function to print out results because you can later easily search and find in your code lines where you display final or intermediate results. Of course you will type a bit more, but it will save you time in longer run.
++++
* Create two variables called //probability_1// and //probability_2// and assign them values of 0.1 and 0.01, respectively. Compute a new variable //odds// by dividing probability_1 by probability_2. Display //odds// on the screen by ensuring there is semicolon at the end of the line where you display that result.
++++ Solution |
probability_1 = 0.1;
probability_2 = 0.01;
odds = probability_1 / probability_2;
disp(odds);
%
++++
* List all the variables that were generated during current session. How many did you get?
++++ Solution |
who;
% You will get back list of all variables. There should be if you completed all assignments so far.
% However, if you completed it your own way, you may get different result. Here is what I got:
% long_paragraph num_sentences num_words odds probability_1
% probability_2 simple_text visual_intensity
++++
* Delete variable //probability_1//.
++++ Solution |
clear probability_1;
who;
% probability_1 is now missing from the list of in-memory variable.
% You may notice that function clear
% You will get back list of all variables. There should be if you completed all assignments so far.
% However, if you completed it your own way, you may get different result. Here is what I got:
% long_paragraph num_sentences num_words odds probability_1
% probability_2 simple_text visual_intensity
++++
* Delete all variable and check that there are none left in the memory.
++++ Solution |
clear all
who
% The command will return empty result because we just deleted all variables.
% You may want to do this to clear up memory, but be careful that you can recompute everything
% and ensure that you wouldn't lose the results permanently.
++++
==== 2. MATLAB Vector & Matrix ====
* Powerpoint: {{ :matlab_training:matlab_vectormatrix02.pptx |}}
* Vector & Matrix Demo: {{ :matlab_training:vector_demo.m |}}
* Vector & Matrix Practice:{{ :matlab_training:vector_practice.m |}}
==== 3. MATLAB Plot ====
* Powerpoint:{{ :matlab_training:matlab_plotstatement03.pptx |}}
* Plot Demo: {{ :matlab_training:plot_demo.m |}}
* Plot Practice:{{ :matlab_training:plot_practice.m |}}
==== 4. MATLAB Statement ====
* If else, switch, loop Demo: {{ :matlab_training:statement_demo.m |}}
* If else, switch, loop Practice:{{ :matlab_training:statement_practice.m |}}
* Practice solution:{{ :matlab_training:statement_practice_with_solution.m |}}
==== 5. MATLAB Reading and Writing files ====
* Reading and Writing files Demo:{{ :matlab_training:read_writefile_demo.m |}}
* Reading and Writing files Practice:
* Create a 3 x 6 matrix of random integers, each in the range from 50 to 100. Write this to a file called randfile.mat. Then, read the file just to make sure that it worked!
==== 6. MATLAB Other useful functions ====
* Other useful functions Demo:{{ :matlab_training:otherfunctions_demo.m |}}
* {{ :matlab_training:average.m |}}
* {{ :matlab_training:stat.m |}}
* Other useful functions Practice:{{ :matlab_training:otherfunctions_practice.m |}}
* Practice solution{{ :matlab_training:otherfunctions_practice_with_solution.m |}}
==== 7. Start Psychtoolbox ====
* Psychtoolbox PPT:{{ :matlab_training:matlab_psychtoolbox04.pptx |}}
* Psychtoolbox Demo: {{ :matlab_training:draw_stuff.m |}} {{ :matlab_training:draw_stuff2.m |}} {{ :matlab_training:draw_stuff3.m |}}
==== 8. Present Images and Sound in Psychtoolbox ====
* Psychtoolbox PPT:{{ :matlab_training:matlab_psychtoolbox05.pptx |}}
* Psychtoolbox Demo:
* {{ :matlab_training:presentimagdemo.zip |}}
* {{ :matlab_training:waves.zip |}}
==== 9. Record Response and Output in Psychtoolbox ====
* Psychtoolbox Demo:
* {{ :matlab_training:mousingaround.m |}}
* {{ :matlab_training:get_key_name.m |}}
* {{ :matlab_training:exit_on_esc.m |}}
* {{ :matlab_training:speed_test.m |}}
* {{ :matlab_training:guessing_game.m |}}
* {{ :matlab_training:guessing_game2.m |}}
* {{ :matlab_training:cell2csv.m |}}
==== 10. Some Psychtoolbox demos ====
* OldNewRecognition
* SimpleImageMixingDemo.m
* ImageMixingTutorial.m
* AlphaImageDemo.m
* AlphaImageTutorial.m
* KbDemo.m
* KbQueueDemo.m
* MouseTraceDemo.m
* ProceduralNoiseDemo.m
* check error matlab file : {{ :matlab_training:practice2_class07.m |}}
==== 11. fMRI Experiment Design ====
* fMRI exp design powerpoint: {{ :matlab_training:introfmri_expdesign_100517.pptx |}}
* {{ :matlab_training:charlocalizer_epi.m |}}
* {{ :matlab_training:charlocalizerlist.txt |}}
* {{ :matlab_training:vwf.m |}}
* {{ :matlab_training:vwf_procedure.doc |}}
==== Useful website ====
* MATLAB for beginner https://au.mathworks.com/support/learn-with-matlab-tutorials.html
* interactive matlab http://www.imc.tue.nl/
* Psychtoolbox Demo http://docs.psychtoolbox.org/PsychDemos