help me debug - how to prevent code from collating with for loop?

조회 수: 1 (최근 30일)
Cside
Cside 2019년 12월 3일
댓글: Cside 2019년 12월 4일
Hi, I have this code that goes like this and I do not understand why the problem matrix is collated i.e. it gives a size of 22010 x 1, when the second line of code is only meant to extract a matrix from a cell array (answer should be 270x1, or 280x1 depending on A). Is there a way I can ensure that the second line of code does not collate but rather extracts the specific matrix from cell array locationsacc? Thank you!
Additional info:
locationsacc - 8x1 cell
A - 66x1 double
sessions_fef - 131x1 double
for j = A
problem = cell2mat(locationsacc(sessions_fef(j,1))); %%why is it 22010!!!
firing1 (:,j) = accumarray (problem, dataset_fef_sac_all(j,:)); %%collated firing rates for 8 locations
end
  댓글 수: 2
Stephane
Stephane 2019년 12월 3일
You can break down the problematic line to several lines of code, with extra variables. One of the three calls "cell2mat(locationsacc(sessions_fef(" is faulty.
Cside
Cside 2019년 12월 4일
thanks! i managed to debug it :)

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Solar Power에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by