필터 지우기
필터 지우기

Unable to perform assignment because the left and right sides have a different number of elements.

조회 수: 1 (최근 30일)
Hi, everyone
This is my code, but when I'm doing to run it.. appears this error:
Unable to perform assignment because the left and right sides have a different number of elements. In particular in this line: correlation(t) = corrcoef(LFP1_t, LFP2_t). But LFP1_t ed LFP2_t are both two vectors of 1000x1.
How can I fix the problem?
start_stop_plot = [871.620 1015.860];
window = 1*new_fs; % 1 second of window
start_stop_plot_points = [start_stop_plot(1)*new_fs, start_stop_plot(2)*new_fs];
correlation = zeros(start_stop_plot_points(2)-start_stop_plot_points(1),1);
for t=start_stop_plot_points(1):start_stop_plot_points(2)-window;
LFP1_t = data_1(t:t+window-1);
LFP2_t = data_2(t:t+window-1);
correlation(t) = corrcoef(LFP1_t, LFP2_t);
end
figure
plot(new_time(start_stop_plot_points(1):start_stop_plot_points(2)),...
correlation(start_stop_plot_points(1):start_stop_plot_points(2)),'black');
xlabel('Time (s)'); ylim([-1 1])

답변 (1개)

Jan
Jan 2022년 11월 21일
편집: Jan 2022년 11월 21일
"But LFP1_t ed LFP2_t are both two vectors of 1000x1." - yes, of course, but the left side of the assignment correlation(t) is a scalar.
correlation(t) = corrcoef(LFP1_t, LFP2_t)
% [1x1] = [2 x 2] ==> Error!
  댓글 수: 2
Jan
Jan 2022년 11월 21일
I assume, I cannot guess this. How would you like to solve this? It depends on what you want to implement. Currently you assume, that you can store the output of the corrcoef function in a scalar. I cannot know, what you want to do instead.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by