What is the equivalent of readtable (2014-2016 version) function in the 2010/2011 version

조회 수: 6 (최근 30일)
I have the following funnction and codes below (associated with the function) which were written in the 2016 version. However, I have the 2011 version and readtable was introduced in 2014 only. At work I have an even older version (2010b). So I would like to know if someone can help me adapt these lines of codes below so that I can use them in the older version:
here is the function:
function [ComPrices,Com,Year,T,t,Residuals,Aobs,options,solveroptions,N,mina,maxa,r,delta] = OverallInitialization()
% OVERALLINITIALIZATION Initializes all the general parameters for the estimations
%
%%Load list of commodities and prices
Com = {'Banana';
'Cocoa';
'Coffee';
'Copper';
'Cotton';
'Jute';
'Maize';
'Palmoil';
'Rice';
'Sugar';
'Tea';
'Tin';
'Wheat'};
%
%ComPrices = csvwrite('ComPrices-1900-2011.csv');
ComPrices = importdata('ComPrices-1900-2011.csv');
load('ComPrices.mat')
ComPrices = ComPrices(:,Com);
%
Year = str2num(cell2mat(ComPrices.Properties.RowNames));
T = length(Year);
t = (1:1:T)'/T;
Residuals = array2table(NaN(T,length(Com)),...
'RowNames',ComPrices.Properties.RowNames,...
'VariableNames',Com);
Aobs = Residuals;
%
%%Options
fminconoptions = optimoptions('fmincon' , ...
'Algorithm' , 'sqp',...
'DiffMinChange', eps^(1/3),...
'Display' , 'iter-detailed',...
'FinDiffType' , 'central',...
'MaxFunEvals' , 1E4,...
'TolFun' , 1e-6,...
'TolX' , 1e-6,...
'UseParallel' , true);
%
pswarmoptions = struct('CPTolerance', 1e-6,...
'MaxIter' , 700,...
'MaxObj' , 5E5,...
'Size' , 700);
%
solveroptions = struct('fmincon' , fminconoptions,...
'pswarm' , pswarmoptions);
%
options = struct('cov' , 2,...
'Display' , 0,...
'estimator' , 'UML',...
'InterpMethod' , 'spline',...
'MaxIter' , 1E3,...
'ncpu' , 8,...
'numhessianoptions',struct('FinDiffRelStep' , 1E-3,...
'UseParallel' , true),...
'seed' , 1,...
'TolX' , 1E-10,...
'UseParallel' , 'never',...
'Vectorized' ,'on');
options.solver = {'PSwarm' 'fmincon'};
options.solveroptions = {pswarmoptions fminconoptions};
%
%%Define the grid of interpolation (equally space points)
N = 1000; % number of points on the approximation grid
mina = -2; % lower limit of the grid
maxa = 20; % upper limit of the grid
%
r = 0.05; % Interest rate assumed exogenous and fixed
delta = 0; % Decay rate assumed exogenous and fixed at zero
  댓글 수: 4
Walter Roberson
Walter Roberson 2016년 12월 10일
Particleswarm was not implemented back then either. You would have to look in the File Exchange to see if one of the pso contributions was useful for your purpose.
Anthony Mukanya
Anthony Mukanya 2016년 12월 12일
Thanks guys.
I saw a video online where dataset was used. However, I am wondering if I can use this built-in function with csv file.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by