필터 지우기
필터 지우기

How can I assign values to my whole cell array? I am getting [], but am unsure as to why.

조회 수: 2 (최근 30일)
I want my code to assign epochs (in 'a' datapoint intervals) into a cell array. In this case 'a' is 200. Total recording length is 587 epochs. 'k' is my patient number. Therefore, in this use case I should have a cell array with 46x587 cells, where each cell contains a 21x200 double. My code can be seen below:
for k = 1:46
for i = 1:b
NC_x{k, i} = NC_patient{k}(:,a*(i-1)+1:a);
end
end
Unfortunately, only the first column of my cell array is assigned the 21x200 doubles. Why is this, and how can I resolve it?
I look forward to receiving a response.
Kindest regards,
Sean
  댓글 수: 2
the cyclist
the cyclist 2022년 2월 24일
It's a bit difficult to know what the problem is. You don't mention what the value of b is. Could it be 1, and therefore you are only operating on the first column, in the loop over i?
Can you upload the data in a MAT file, so we can run your code?
Sean Goulding
Sean Goulding 2022년 2월 24일
Assume b is greater than 1. In this instance it is 587. The code is pretty long, this is just one section of it. I was just wondering if there was any obvious reason why variables past the first column aren't being assigned cells.

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

채택된 답변

Walter Roberson
Walter Roberson 2022년 2월 24일
for k = 1:46
for i = 1:b
NC_x{k, i} = NC_patient{k}(:,a*(i-1)+1:a*i);
end
end

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by