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

21 visualizaciones (últimos 30 días)
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!

Respuestas (0)

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by