Writetable yields error "operator not supported".

Trying to save a table into .csv with writetable. I keep getting the error message below. Similar outcome with write, or writexls. Any cues? Matlab 2021b
>> writetable(all_data,'myData.csv','Delimiter',',')
Operator '==' is not supported for operands of type 'cell'.

6 Comments

What is class(all_data) ? I suspect it is cell, but would need to be table.
Also, is it possible that the table has non-scalar cells stored inside it? Like all_data.SomeVar(5) might be a cell array? I am excluding here the where the variable is character vectors, which would be stored internally as the entire variable being a cell array of character vectors.
class(all_data) is 'table'.
All variables are numeric, although if they had strings in it should still work isn't it?:
numericVars = varfun(@isnumeric,all_data,'output','uniform') numericVars =
1×19 logical array
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Maybe it's due to the variable names having some illegal character?
all_data.Properties.VariableNames
ans =
1×19 cell array
Columns 1 through 5
{'subject'} {'acc_con'} {'acc_incon'} {'acc_CS-'} {'acc_CS-_con'}
Columns 6 through 10
{'acc_CS-_incon'} {'acc_CS+'} {'acc_CS+_con'} {'acc_CS+_incon'} {'acc_grey'}
Columns 11 through 14
{'acc_grey_con'} {'acc_grey_incon'} {'RT_CS-_con'} {'RT_CS-_incon'}
Columns 15 through 19
{'RT_CS+_con'} {'RT_CS+_incon'} {'RT_grey_con'} {'RT_grey_incon'} {'odd_even'}
As an experiment, try
restoredefaultpath; rehash toolboxcache
and try again.
You just might have a third-party toolbox that is providing functions that are interfering. For example do you have SPM12 installed ?
That fixed it! thanks!
As third-party I think I only have Psychtoolbox and ANSLAB installed.
I am not familiar with ANSLAB.
Psychtoolbox is usually pretty good about not interfering with MATLAB.
You could add one of those at a time back to your MATLAB path, to see which of the two packages is causing the problem.

Sign in to comment.

Answers (0)

Asked:

on 6 Sep 2022

Commented:

on 6 Sep 2022

Community Treasure Hunt

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

Start Hunting!