Creating variables in a for loop
显示 更早的评论
I have n .xyz files that I want to load and manipulate. For each file, I want to create 3 column vectors (the x, y, and z coordinates). Is there a way to do that without writing out xn=filen(:,1) etc. for each file? My first thought was a for loop, but I'm not sure how that would work.
file1 = load('BRS_19920109.xyz');
file2 = load('CEL_19920110.xyz');
file3 = load('MLI_19920115.xyz');
file4 = load('BIJ_19920114.xyz');
file5 = load('MHR_19920115.xyz');
file6 = load('PRE_19920115.xyz');
%Creating vectors for x,y,z for each file.
x1 = file1(:,1);
y1 = file1(:,2);
z1 = -file1(:,3);
x2 = file2(:,1);
y2 = file2(:,2);
z2 = -file2(:,3);
%etc.
Thanks for taking a look.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!