writetable does not work. Error: Search term must be a text or pattern scalar.

13 views (last 30 days)
writetable() does not write the table in my matlab2023a. It created an empty file and in the command propt this message is printed: "Search term must be a text or pattern scalar." This message does not have an "Error" label, but is red as an error.
This happen even with very simple tables as the next ones:
t=table([1:10;11:20]);
writetable(t,'t.csv')

Accepted Answer

Walter Roberson
Walter Roberson on 4 Aug 2023
You have a third-party toolbox that is defining a function with the same name as a Mathworks-supplied function, and that is leading to problems.
As an experiment try
restoredefaultpath; rehash toolboxcache
and then re-run your experiment. If it now works, then you definitely have something on your path that is interfering. (If it still does not work, then the interfering file might be in the current directory.)
I suspect that in your case, the interferring function is named pattern.m but I am not at all certain about that.
Do you have SPM or dfield8 installed?
  1 Comment
Armando Angulo
Armando Angulo on 4 Aug 2023
Thank you! I only have to select the default option in the Set Path. Of course I still need to looking for the problematic file.

Sign in to comment.

More Answers (0)

Categories

Find more on Testing Frameworks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!