Matlab - Warnings and unwanted default values added to dataset output variable

I am attempting to create a dataset with 3 output variables:
1.) a row vector with column names
2.) a column vector with observation names
3.) a matrix with the relevant data
I have attempted 2 approaches and each gives me the same problem with the output variable for column names.
1st Method:
%%Get Data Matrix with columns
colNames = {'Mkt-RF', 'SMB', 'HML', 'RF'};
m = {returns, colNames{1:4}}; % 'returns' is a matrix of return data
Then create a dataset and use its Property values to assign output variables:
FF = dataset(m, 'ObsNames', dates); % 'dates' is a cell array of dates
FF.column = get(FF,'VarNames'); % column names
FF.date = get(FF,'ObsNames'); % row names
FF.Return = returns; % return data
2nd Method: Skip the initial dataset creation (FF = dataset(...)) and simply construct it from the output variables:
FF.column = colNames(1:4);
FF.date = dates;
FF.Return = returns;
Each approach constructs the dataset without any issues for the '.date' or '.Return' outputs, but unfortunately for the '.column' variable, it produces the following:
Warning: Observations with default values added to dataset variable
'column'.
As a result, because it's a [1 x 4] vector and there are multiple observations in the dataset, calling 'FF.column' produces the following:
'Mkt_RF' 'SMB' 'HML' 'RF'
[] [] [] []
[] [] [] []
[] [] [] []
[] [] [] []
How can I eliminate the unwanted additional default values that have been added? I just want to call 'FF.column' and have it output a simple, clean row vector:
'Mkt_RF' 'SMB' 'HML' 'RF'
I would think it's a fairly simple solution, but so far I've been unable to find it. Any assistance would be greatly appreciated.

Answers (0)

Categories

Products

Asked:

on 15 Nov 2015

Community Treasure Hunt

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

Start Hunting!