Clear Filters
Clear Filters

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

5 views (last 30 days)
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!

Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!