Dot Indexing is not supported

조회 수: 1 (최근 30일)
Jennifer March
Jennifer March 2021년 5월 26일
편집: Jennifer March 2021년 5월 28일
Hi there,
In my analysis I am running into the error "Dot Indexing is not supported for variables of this type", for the following line (shortened):
i_hclc=~cellfun(@isempty,regexp(raw.cond,contrast_select{i}{1}));
%% Contrast images for mega-analysis
contrast_select={{'High_Cal_Low_Cal',...% Floor_21
'NaN'},...
{'High_Cal_Low_Cal',...% Floor_16
'NaN'},...
{'High_Cal_Low_Cal',...% Smeets 18
'Food_Nonfood'},...
{'NaN',... %Smeets_13
'Food_Nonfood'}};
%% Get data
subject_level_vars={'study_ID','sub_ID','gender','age','BMI',...
'hunger_state'};
contrast_level_vars={'sub_ID','cond'};
df.subjects=repmat({table()},4,1);
for i=1:length(df.study_ID)
raw=df.raw{i,1}; %Get all images from current study
i_hclc=~cellfun(@isempty,regexp(raw.cond,contrast_select{i}{1}));
i_fnf=~cellfun(@isempty,regexp(raw.cond,contrast_select{i}{2}));
end
My dataframe summarises the different studies in my analysis(4x24), the column raw in dataframe is a table of the subject information within each study (Number of participants of study x 8). The latter contains the column "cond"
smeets_13.cond = repmat({'Food_Nonfood'},size(smeets_13.con_img));
Thank you for any help!
  댓글 수: 5
Rik
Rik 2021년 5월 26일
That is the most likely explanation. You might consider changing your loop.
About your loop: it overwrites the results, so only the last iteration will actually be stored. You are also using length, instead of numel or size, which may lead to unintended behavior for array inputs. And personally I try to avoid i and j as variables.
Jennifer March
Jennifer March 2021년 5월 28일
That was it! Thank you!

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by