필터 지우기
필터 지우기

How to save sub-fields of a structure in txt file format with the same filenames in a loop

조회 수: 2 (최근 30일)
clc
clear all
close all
% folder = uigetdir();
% fileList = dir(fullfile(folder, '*.bmp'));
files = dir('*.lvm');
nfiles=length(files);
for K=1:140
basename = sprintf('Metal_%d', K);
filename = [basename '.lvm'];
outfile = [basename '.mat'];
signal= [basename '.txt'];
%clear data
if exist(filename, 'file') == 0
continue;
end
data.(basename) = lvm_import(filename, 1);
%save(outfile, '-struct', 'data')
end
Here is my code above. I was trying to save the data sub-filed having an order 204800x2 in text file in a loop. There are 121 structures generated by the code.
Kindly assit as soon as you ca.
Thanks.

답변 (1개)

Voss
Voss 2021년 12월 18일
이동: Voss 2024년 1월 2일
To save a matrix to a text file, you can use writematrix.

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by