error using writetable. txt is a unrecognized file extension. use the FileType parameters to specify the file type
조회 수: 6 (최근 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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/210179/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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!