Why do I get the error 'Unable to use a value of type cell as an index.'?

8 views (last 30 days)
While creating an array2table, it shows an error 'Unable to use a value of type cell as an index.' How can I fix it? (don't pay attention on broken comment font).

Answers (1)

Steven Lord
Steven Lord on 8 Nov 2021
Is that table.m file that you have open in the Editor the one included with MATLAB, in which case you shouldn't have modified it? Or is it one that you've created yourself, in which case I recommend renaming it so it doesn't conflict with the table class included in MATLAB?
Regardless I'm guessing the presence of that table.m is the cause of this error.
  3 Comments
Steven Lord
Steven Lord on 9 Nov 2021
Let's make sure you haven't accidentally shadowed the array2table function with either your own array2table.m or a variable named array2table. What does this command return?
which -all array2table

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by