load a variable in matlab
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 no开发者_如何学编程t (image01), how should I do it regards,
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.
精彩评论