Cannot load MATLAB file properly

2 views (last 30 days)
Le Zhao
Le Zhao on 23 Mar 2019
Commented: Rik on 23 Mar 2019
load Data_USYieldCurve
% Extract data for the last day of each month
MonthYearMat = repmat((1990:2010)',1,12)';
EOMDates = lbusdate(MonthYearMat(:),repmat((1:12)',21,1));
MonthlyIndex = find(ismember(Dataset.Properties.ObsNames,datestr(EOMDates)));
Estimationdataset = Dataset(MonthlyIndex,:);
EstimationData = double(Estimationdataset);
When I was trying to run this code, it always gives me the warning:
Variable 'Dataset' originally saved as a dataset cannot be instantiated as an object and will be read in
as a uint32.
which leads me unable to access 'Dataset' properly with dot index.
I understand it's because the definition for the object's class is not available to MATLAB. And it has something to do with my add-on toolbox? I am using Financial Toolbox and Financial Instrument Toolbox.
Could any help me solve this error or recommend me a toolbox that works.
Thanks a lot!

Answers (1)

Rik
Rik on 23 Mar 2019
The dataset class is part of the Statistics (and Machine Learning) Toolbox according to the doc. So you will either need to re-implement it yourself, or get that toolbox.
Also, it would be wise to heed the warning at the top of that page. The benefit of moving to a table (as suggested) is that you don't need any toolbox to work with those. The table data type was introduced in R2013b, so unless you need extreme backwards compatability (for something between R2007a and R2013b), you should seriously consider moving.
  2 Comments
Le Zhao
Le Zhao on 23 Mar 2019
Thanks for helping!
The problem is I have downloaded Statistics Toolbox before, and it shows dataset may be removed in future release, and it suggests me to use table. So I guess that's why I cannot use dataset in this case.
I wonder how can I convert dataset to table in this case?
Or if I still want to use dataset, is there any suggestion on how to do that?
Thanks!
Rik
Rik on 23 Mar 2019
It shows that warning in the R2018b doc. I don't know if it will be removed in R2019a, but if you're not using the prerelease the class should still be there. Are you sure you installed the toolbox correctly?
I don't have a suggestion how to convert your dataset object to a table, as I have never worked with dataset, nor have I a lot of experience with the table data type. I would think the best solution will also depend on the kind of data you want to store.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!