开发者

load a variable in matlab

开发者 https://www.devze.com 2023-02-19 20:26 出处:网络
I want to load variables in a loop with different imagenames. for i=1:length(imagefile) name=imagefile{i};

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消