Sie verfolgen jetzt diese Einreichung
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
function cell2txtfile(file,cell_array)
%%Written by Li CHEN on 22 Jan 2015, inspired by dlmcell %
%It is faster than dlmcell %
% <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> %%
% <><><><><> cell2txtfile - Write Cell Array to Text File <><><><><> %
% <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> %
% %
% 1. Input %
% - file The output filename (string). %
% - cell_array The cell array to be written. %
% %
% 2. Output %
% - filename.txt %
% 3. Example %
% cell2txt('filename.txt',cellarray); %
% %
% <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> %
%% Check input arguments
if nargin < 2
disp('Error - Give at least two input arguments!');
return;
elseif nargin > 2
disp('Error - Do not give more than 2 input arguments!');
return;
end
if ~ischar(file)
disp(['Error - File input has to be a string (e.g. ' ...
char(39) 'output.txt' char(39) '!']);
return;
end;
if ~iscell(cell_array)
disp('Error - Input cell_array not of the type "cell"!');
return;
end;
delimiter = '\t';
append = 'w';
%% Open output file
%tic
output_file = fopen(file,append);
[m,n]=size(cell_array);
%% Evaluate and write input array to the output file.
%disp('Writing the data to a txt file, wait a moment...')
for i=1:m
temp=strjoin(cell_array(i,:),delimiter);
fprintf(output_file,'%s\r\n',temp);
end
%% Close output file.
fclose(output_file);
%toc
Zitieren als
Li Chen (2026). cell2txtfile(file,cell_array) (https://de.mathworks.com/matlabcentral/fileexchange/49113-cell2txtfile-file-cell_array), MATLAB Central File Exchange. Abgerufen .
Quellenangaben
Inspiriert von: dlmcell
Allgemeine Informationen
- Version 1.1.0.0 (2,07 KB)
Kompatibilität der MATLAB-Version
- Kompatibel mit allen Versionen
Plattform-Kompatibilität
- Windows
- macOS
- Linux
| Version | Veröffentlicht | Versionshinweise | Action |
|---|---|---|---|
| 1.1.0.0 | data export |
||
| 1.0.0.0 |
