%% Import data raw_data = readtable('data.txt'); %*****Question 1 - try the following line: % uiimport('data.txt'); % opens up a GUI for data details % Please pay attention to different columns, and try to understand the % data structure % Select column 8/9/10 for downstream analysis table_data = raw_data(:, 8:10); % convert table format to array data = table2array(table_data); %*****Question 2 - try using 'help' function to understand 'table2array' %% Data processing % basic info about the raw data % raw_data{:,1} - name % raw_data{:,2} - sex % raw_data{:,3} - note % raw_data{:,4} - number of subject % raw_data{:,5} - subject age % raw_data{:,6} - (experimental) block number % raw_data{:,7} - trial number % raw_data{:,8} - motion conditions: % ==1 - continuous motion; ==2 - motion with stop % raw_data{:,9} - sound conditions: % ==1 - sound absent; ==2 - sound present % raw_data{:,10} - bounce responses (dependent variable) % after the column selection: % raw_data{:,8} == data(:,1); % raw_data{:,9} == data(:,2); % raw_data{:,10} == data(:,3); N = 10; % sample size m = zeros(2, 2); m(1,1) = mean(data(data(:,1)==1 & data(:,2)==1, 3)); % continuous motion no sound m(1,2) = mean(data(data(:,1)==1 & data(:,2)==2, 3)); % motion with stop m(2,1) = mean(data(data(:,1)==2 & data(:,2)==1, 3)); % sound absent m(2,2) = mean(data(data(:,1)==2 & data(:,2)==2, 3)); % sound present %*****Question 3 - what is 'm'? err = zeros(2,2); err(1,1) = std(data(data(:,1)==1 & data(:,2)==1, 3))/sqrt(N); % continuous motion err(1,2) = std(data(data(:,1)==1 & data(:,2)==2, 3))/sqrt(N); % motion with stop err(2,1) = std(data(data(:,1)==2 & data(:,2)==1, 3))/sqrt(N); % sound absent err(2,2) = std(data(data(:,1)==2 & data(:,2)==2, 3))/sqrt(N); % sound present %*****Question 4 - what is 'err'? %*****Question 5 - what does the function 'sqrt' do? %% Data visualization % using barweb (bar graph with error bars) % https://www.mathworks.com/matlabcentral/fileexchange/10803-barweb-bargraph-with-error-bars barweb(m, err, [], {'without stop', 'with stop'}, [], {'kind of motion'}, ... {'percent bouncing'}, [], [], {'no sound', 'sound'}) %*****Question 6 - understand all the parameters feeding in 'barweb' figure(1); %*****Quesiton 7 - adjust the figure legends / colours of your own choice, %and save the figure with .png format %*****Question 8 - how to change the percentage from 0.1-1 to 10%-100%? %*****Question 9 - reflection of the underlying experiment: %read the original paper thoroughly and compare the original result with % the figure you produced.