Error using reshape because "size arguments must be real integers"
10 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2020-5-2
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,[]);
采纳的回答
Steven Lord
2020-5-2
You said that "Activity_dff is a 1200640x1 matrix of decimal numbers. " You then compute
sz = size(vector);
% groupZ_value = sz(3)/slice_number;
slice_number = sz(2)/group_z_value; %giving 766
sz(2) is 1 and group_z_value is 2560 meaning slice_number is much smaller than 1. It certainly isn't an integer value.
If your Activity_dff vector were a row vector (1x1200640) instead of a column vector then slice_number would be an integer value (though your comment is incorrect, it's not 766.)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!