0

I would like to create a struct , its fields can take a value or a list of values ,e xample

myStruct.file 
myStruct.format

the value of myStruct.file can be : one file or a list of files the value of myStruct.format can be one format or a list of formats : txt,xml,.c

so if I try in the case of a list of files :

myStruct.file = {'file1','file2'}
if strcmp(x,1)
subFiles = {fullfile(myStruct.file, 'toto','control.txt'),fullfile(myStruct.file, 'toto','model.txt')};
for m=1:numel(subFiles)
....
end

do you know how this can be implemented ? any suggession ? Thanks, Regards

1
  • 1
    I don't understand what you mean... Can you explain "myStruct.file can take one file or a list of files myStruct.format can take one format or a list of formats : txt,xml,.c" a bit better? What do you mean by "take one file"? Does it mean a filename? Same for format. Commented Nov 7, 2013 at 16:58

1 Answer 1

2

You can use cell arrays:

myStruct = struct;
myStruct.file = {'file1','file2',...};
myStruct.format = {'format1','format2',...};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.