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 Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by