Divide a column of a datafile through a constant value
조회 수: 4 (최근 30일)
이전 댓글 표시
I have a large number of datafiles (.txt file) and I need to divide one of the columns to a constant number. What is the short way to do it.
댓글 수: 3
답변 (1개)
KSSV
2022년 5월 23일
txtFiles = dir('*.txt') ; % you are in the folder of text files
N = length(txtFiles) ; % total files
% loop for each file
for i = 1:N
txtFile = txtFiles(i).name ;
T = readtable(txtFile) ; % also have a look on load, importdata
T.(1) = T.(1)/100 ; % divide first column by 100
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Directed Graphs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!