Irregular data txt, excel extraction

버전 1.0.0 (52.4 KB) 작성자: Shengjie Ren
Irregular data txt, excel extraction
다운로드 수: 5
업데이트 날짜: 2021/12/9

라이선스 보기

clc
%% 读取原始数据txt文本
x1=readtable ("old_data.txt");
x2=table2array(x1);%转化为cell
%% 提取x y z 坐标
for i=1:5:size(x2,1)
x3(i,1) =x2(i,1);
end %提取第一列
x3(cellfun(@isempty,x3))=[];%删除空矩阵
for i=1:length(x3)
x{i}=str2num(x3{i});
end
for i=1:length(x)
x4(i,:)=x{i};
end %cell转double
zuobiao=x4(:,2:end);
%% 提取stress应力值
for i=3:5:size(x2,1)
x5(i,1) =x2(i,1);
end %提取第一列
x5(cellfun(@isempty,x5))=[];%删除空矩阵
writecell(x5,'F:\admin\RenSJ\Matlab\export_stress\N_data.txt','Delimiter','tab');%保存为N_data.txt准备再次提取,这两行结果一样
[stress]=textread('.\N_data.txt','%*s %*s %f') ;%读取文件N_data.txt,%*s表示跳过两个英文读单词,%f读取第三列数字
%% 合并X Y Z 以及stress值并保存为data.txt
data=[zuobiao stress]; %目标数据
writematrix(data,'F:\admin\RenSJ\Matlab\export_stress\new_data.txt','Delimiter','tab')
delete('N_data.txt')

인용 양식

Shengjie Ren (2024). Irregular data txt, excel extraction (https://www.mathworks.com/matlabcentral/fileexchange/103200-irregular-data-txt-excel-extraction), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2021b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
태그 태그 추가

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0