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.

 Respuesta aceptada

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Preguntada:

el 22 de Abr. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by