Set Properties​.VariableC​ontinuity to a single column in a timetable?

3 views (last 30 days)
Hi,
I tried to set the Properties.VariableContinuity for a single column in my timetable. This is neccesary, as I have a modular code and the size (and especcialy the order of columns) are changing. I tried it the following way:
dataTable.Properties.VariableContinuity{'room_t'} = 'continuous';
I allways get the following error:
"Brace indexing is not supported for variables of this type."
Do you have any idea?
Sven

Accepted Answer

dpb
dpb on 12 Aug 2019
Per the documentation, ". This property can be an empty array, which is the default. If the array is not empty, then the number of elements must equal the number of variables."
You can't set just one column, you must define a cell array of the size of the timetable number of variables and assign that...see the doc for example.
dataTable.Properties.VariableContinuity = {'continuous', ...};
would be the syntax where the RHS cellstr matches your timetable. Use 'unset' for all other variables you don't want/need to set specifically.
  2 Comments
Sven F. Biebricher
Sven F. Biebricher on 12 Aug 2019
Thanks for your quick answer. I will try that, but I have to build a little workarround as the size of the table and the position of the named columns is changing.
dpb
dpb on 12 Aug 2019
OK, just did something similar the other day in another answer. Find the right column using the
dataTable.Properties.VariableContinuity=repmat({'unset'},1,size(dataTable,2));
dataTable.Properties.VariableContinuity(contains(TT.Properties.VariableNames,'room_t'))={'continuous'};

Sign in to comment.

More Answers (0)

Categories

Find more on Data Import and Export in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!