How do I load these files using the directory and then reinvert the matrix?

2 visualizaciones (últimos 30 días)
PathStr = 'c:\Users\Laurentiu Galan\Desktop\tickoutput';
Files = dir(fullfile(PathStr,'*.csv'))
for k=1:length(Files)
Data=importdata(fullfile(PathStr,Files(k).name));
end
This is the code that will load my files into a directory (thanks to Fangjun Jiang). However, I don't know how to navigate this directory. Each file is a yahoo finance .csv file that has headers in the first row: Date, Price, Adjusted Price. The values in the rows below are numbers and dates. Unfortunately, the values are backwards, i.e. the value in the second row is the information from 11/9/11. The third row is from 11/8/11, etc... How do I reorder each file so that the values from rows 2 till the end are inverted? I.E. so my second row entry is from 5/20/06 (when the data starts) and the final is from 11/9/11. FInally, how do I overwrite my existing files in the same path. SOrry, i recognize this is extensive, but I would really appreciate it. I am learning Matlab now and this is the first major project ive been given.

Respuestas (1)

Image Analyst
Image Analyst el 13 de Nov. de 2011
To flip a matrix:
m_Flipped = flipud(m);
See the FAQ http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F for info on how to batch process files.

Categorías

Más información sobre Financial Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by