Error: unable to resolve the name

86 views (last 30 days)
Emu
Emu on 21 May 2024
Commented: Emu on 21 May 2024
I have some code which generates a variable name iteratively in a loop, It was working fine but now I get the error: unable to resolve the name 'pre1min.windowchunkIdx'.
preORpost = {'pre' 'post'}
all_type_ALL = []; %output for all voc types for all ppts
%load raw data
for pOp = 1:length(preORpost)
for min = 1:2
%window = [preORpost{pOp} num2str(min) 'min'];
varName = [preORpost{pOp} num2str(min) 'min']; % Generate variable name
fieldName = 'windowchunkIdx'; % Generate field name
windowchunk = eval([varName '.' fieldName]);
  1 Comment
Stephen23
Stephen23 on 21 May 2024
Edited: Stephen23 on 21 May 2024
You did not tell us the most important information: how exactly did you get all of those variables into the workspace?

Sign in to comment.

Accepted Answer

Kunal Kandhari
Kunal Kandhari on 21 May 2024
The error, "Unable to resolve the name 'pre1min.windowchunkIdx'." suggests that the variable 'pre1min.windowchunkIdx' (or other similar variables) does not exist in the current workspace or does not have the expected structure. To address this, you need to ensure that these variables are loaded correctly and have the expected fields.
  1 Comment
Emu
Emu on 21 May 2024
Ohhhh yes, i jsut reordered the script so this is below the loading, thank you :)

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!