Error using reshape because "size arguments must be real integers"
조회 수: 9 (최근 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!