error using writetable. txt is a unrecognized file extension. use the FileType parameters to specify the file type

조회 수: 19 (최근 30일)
Hi everyone,
When I'm running an experiment, I save all my results in a table named "Data" for each trial. After finishing the whole experiment, I want to save this Data table under the name of the experiment and subject number (for example, MTST-099) and save it as a text document.
First, I put a function named WriteData as shown in below
function WriteData(ExpInfo,SubInfo,Data)
writetable(Data,SubInfo.fileName,'Delimiter','tab');
end
In this function, there is a built-in function named writetable which I have problems with.
function writetable(a,filename,varargin)
% Copyright 2012-2014 The MathWorks, Inc.
if nargin < 2
tablename = inputname(1);
if isempty(tablename)
tablename = 'table';
end
filename = [tablename '.txt'];
end
write(a,filename,varargin{:})
When I tried to run this function(WriteData) to save the results, it returned something like
.Txt is a unrecognized file extension. use the FileType parameters to specify the file type ( as shown in picture).
writetable.png
The computer I used does not install Excel, is this the problem? Or the version is too odl-fashion?
Please help, I really have not idea what to do.
Thanks!

답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by