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.

 採用された回答

Oleg Komarov
Oleg Komarov 2011 年 4 月 22 日

0 投票

1 件のコメント

Jeff
Jeff 2011 年 4 月 22 日
Thank you! This helps me quite a bit.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by