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

6 visualizaciones (últimos 30 días)
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 comentarios
Walter Roberson
Walter Roberson el 10 de Dic. de 2016
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 el 12 de Dic. de 2016
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by