Question

I want to load variables in a loop with different imagenames.

for i=1:length(imagefile) 
      name=imagefile{i}; 
% name=image01% load name  
end

it looks variable (name) and not (image01), how should I do it regards,

Was it helpful?

Solution

Not sure exactly what your variable is. An array of strings?

imaefgile = ["image01", "image02"]
for i=1:length(imaefgile)
    load(imaefgile(i))
end

P.S. you may also need something like:

load(strcat("Folder/", imaefgile(i), ".mat"))

to concatenate the filename appropriately.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top