Dot Indexing is not supported

1 Ansicht (letzte 30 Tage)
Jennifer March
Jennifer March am 26 Mai 2021
Bearbeitet: Jennifer March am 28 Mai 2021
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 Kommentare
Rik
Rik am 26 Mai 2021
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 am 28 Mai 2021
That was it! Thank you!

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by