Error using reshape because "size arguments must be real integers"
Show older comments
Activity_dff is a 1200640x1 matrix of decimal numbers. When trying to do this:
%% Calculate dff
fd = prctile(Activity_smooth,10); %baseline, f0
Activity_dff = Activity_smooth-fd ./ fd;
Activity_dff_ds = group_z_project_vector(Activity_dff,2560); %to see in epoch
I get this:
Error using reshape
Size arguments must be real integers.
Error in group_z_project_vector (line 6)
vector2 = reshape(vector,sz(1),group_z_value,slice_number);
Error in StimulusTestNew (line 95)
Activity_dff_ds = group_z_project_vector(Activity_dff,2560); %to see in epoch
And this is group_z_project_vector:
function [vector_zproj,std_zproj,SE_zproj] = group_z_project_vector(vector,group_z_value);
sz = size(vector);
% groupZ_value = sz(3)/slice_number;
slice_number = sz(2)/group_z_value; %giving 766
vector2 = reshape(vector,sz(1),group_z_value,slice_number); %% This is where I receive en error
vector_zproj = mean(vector2,2); %group_zvalue mean, meaning mean of the rows
std_zproj = std(vector2,[],3);
SE_zproj = (std(vector2,[],3))./slice_number;
vector_zproj = squeeze(vector_zproj); % Group Z project by appropriate number
std_zproj = squeeze(std_zproj);
SE_zproj = squeeze(SE_zproj);
Can you help wit this?
1 Comment
Walter Roberson
on 2 May 2020
Please check
mod(group_z_value,1)
mod(slice_number, 1)
You need both of those to be 0
Experiment with
vector2 = reshape(vector,sz(1),group_z_value,[]);
Accepted Answer
More Answers (0)
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!