필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Load in multiple MATLAB files and extract 51st row

조회 수: 1 (최근 30일)
Benjamin Cowen
Benjamin Cowen 2018년 8월 17일
마감: Walter Roberson 2018년 8월 17일
Why does my code below not work? I want to read in all the files of a certain type which works. But I want to create a matrix of the 51st row of each file. Note that in the files, there is a single header row.
clear
clear all
clc
projectdirectory = 'C:/Path/';
dinfo = dir( fullfile(projectdirectory, 'msd.*.data') );
N = length(dinfo);
row51 = zeros(N, 2);
for K = 1 : N
filename = fullfile(projectdirectory, dinfo(K).name);
fid = fopen(filename, 'rt');
row51(K,:) = cell2mat( textscan(fid, '%f%f', 50, 'headerlines', 1, 'collectoutput', true) );
fclose(fid);
end
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 8월 17일
Duplicate question answered at https://www.mathworks.com/matlabcentral/answers/415189-load-in-multiple-text-files-and-store-data-in-a-matrix#comment_601014

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by