Load Data in For loop

1 view (last 30 days)
Ah01mat
Ah01mat on 25 Oct 2011
Answered: Voss on 28 Dec 2021
Hi my problem is i want to open data files respectively(in for loop)
i have n0.mat,n1.mat,n2.mat,...,n999.mat
and
for r=0:999
aa = sprintf('%d',r);
load('n' aa .mat', 'AAA') ;
end
but it isnt working so what can i do?

Answers (1)

Voss
Voss on 28 Dec 2021
for r=0:999
aa = sprintf('%d',r);
load(['n' aa '.mat'], 'AAA') ;
end

Tags

Community Treasure Hunt

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

Start Hunting!