フィルターのクリア

Remove headers from multiple .dat files (EEM Matrices)

5 ビュー (過去 30 日間)
Thomas
Thomas 2017 年 7 月 11 日
回答済み: Fangjun Jiang 2017 年 7 月 11 日
Hello! I currently have a large number of matrices in .dat files that I would like to load. These matrices have three rows of headers and one column that I would like to have removed before continuing. The person who had worked with these matrices before me use to load the matrices one by one to excel and manually remove the top three rows and the first column. They would then load the files into matlab using this script.
files = dir('*.dat');
for i=1:length(files)
eval(['load ' files(i).name ' -ascii']);
end
If anybody has any suggestions, I would love to be able to remove the unwanted rows and columns in matlab, rather than manually removing them in excel. Below I have copied just part of one of the matrices to give you an idea of what I am working with. The 0's are part of the desired matrix, everything else is not.
Best, Thomas

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2017 年 7 月 11 日
Please see this example:
A=magic(5)
A(1:3,:)=[]
A(:,1)=[]

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by