How do I load these files using the directory and then reinvert the matrix?
2 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
Image Analyst
2011 年 11 月 13 日
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.
1 件のコメント
Walter Roberson
2011 年 11 月 13 日
Though in the case of what was asked:
m_semi_Flipped = [m(1,:); flipud(m(2:end,:))];
参考
カテゴリ
Help Center および File Exchange で Financial Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!