writetable command fails for any table in R2020b

조회 수: 8 (최근 30일)
Michael Kerich
Michael Kerich 2022년 5월 26일
댓글: Walter Roberson 2022년 5월 31일
A matlab script that has been running starting failing recently and I found the line that was failing was a writetable command. I looked at the table that was being written but the table looked fine to me. The error message when it failed was "Multiple strings and patterns given must have the same quantity". I made a small table (3x3) using the table command and then tried to use writetable and I got this same message so it seems to be happening for any table. I do not know what to do to resolve this.
  댓글 수: 3
Jan
Jan 2022년 5월 26일
Such problems can happen, if you have modified Matlab's toolbox functions on purpose or accidentally. Are you working with admin privileges? Do you store user-defined functions on top of the path, where they can shadow built-in functions?
Stephen23
Stephen23 2022년 5월 27일
Michael Kerich's incorrectly posted "Answer" moved here:
Here is the information from the Matlab asked for:
>> tm = table ([1,2,3], [9,8,7],[20,21,22])
tm =
1×3 table
Var1 Var2 Var3
___________ ___________ ______________
1 2 3 9 8 7 20 21 22
>> writetable(tm, 'test')
Multiple strings and patterns given must have the same quantity.
>> which -all writetable
/usr/local/MATLAB/R2020b/toolbox/matlab/iofun/writetable.m
/usr/local/MATLAB/R2020b/toolbox/matlab/bigdata/@tall/writetable.m % tall method
As far as I know, this function is the same as it was when it was installed.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2022년 5월 27일
Use the debugger to find out the details. Let Matlab stop, when the problem occurs:
dbstop if caught error
Type this in the command window. Run the code again. When it stops, examine the reason by checking the locally used variables. What are the "multiple strings and patterns" the message is talking of?
Again: Do you store user-defined functions on top of the path, where they can shadow built-in functions?
  댓글 수: 6
Michael Kerich
Michael Kerich 2022년 5월 31일
I tried the UniqueFuncNames and the debugger but neither gave a definitive answer to me. So I assumed you were correct and that some function was interfering with the writetable. I just started removing toolboxes from the PATH until the writetable started to work. So I did discover some kind of function conflict and by removing that toolbox from the path it started to work. So thanks for directing me to look for that.
Walter Roberson
Walter Roberson 2022년 5월 31일
Which toolbox turned out to be the problem?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by