Dot Indexing is not supported

1 次查看(过去 30 天)
Jennifer March
Jennifer March 2021-5-26
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.

请先登录,再进行评论。

回答(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