There is a problem in Matlab with a debug error not properly clear. In our opinion, the debug response provided is incorrect and creates confusion. So we decided to share the solution that could change your life.
Problem
For example if data_acc_processed is a string array and data_header a cell array Matlab return the error “The VariableNames property must contain one name for each variable in the table.”
data_table = table(data,'VariableNames',data_header);
Solution
The solution is to change the command from table to array2table and all is ok:
data_table = array2table(data,'VariableNames',data_header);
So, the problem is not the structure of data_header as suggest the debug!
Write us in the comments if it was useful to you and give us your feedback 🙂