Fix the error with "Error using urlread'

3 visualizaciones (últimos 30 días)
Birsen Ayaz-Maierhafer
Birsen Ayaz-Maierhafer el 1 de Sept. de 2022
Comentada: Birsen Ayaz-Maierhafer el 1 de Sept. de 2022
Hi,
I am using MATLAB with apm (APMonitor) to find the parameters of an equation but I got an error :
"Error using urlread
The value of 'url' is invalid. Expected input to be one of these types:
char
Instead its type was java.net.URL."
Does anyone knows how to fix this?
Thank you in advance
% Add APMonitor toolbox available from
% http://apmonitor.com/wiki/index.php/Main/MATLAB
addpath('apm')
% server and application
s = 'http://byu.apmonitor.com';
a = 'regression';
% clear any prior application
apm(s,a,'clear all');
% load model and data files
apm_load(s,a,'model.apm');
csv_load(s,a,'data.csv');
% configure parameters to estimate
apm_info(s,a,'FV','a');
apm_info(s,a,'FV','b');
apm_info(s,a,'FV','c');
apm_option(s,a,'a.status',1);
apm_option(s,a,'b.status',1);
apm_option(s,a,'c.status',1);
apm_option(s,a,'nlc.imode',2);
% solve nonlinear regression
output = apm(s,a,'solve');
disp(output)

Respuestas (1)

Cris LaPierre
Cris LaPierre el 1 de Sept. de 2022
Assuming you are trying to run the example_nlc demo files that come with APM, I was unable to duplicate your error. Is your path to the APM folder correct taking into consideration your current folder? Is your current folder correct?
Can you provide more details?
unzip apm_matlab_v0.7.2.zip
cd('example_nlc')
% Add APMonitor toolbox available from
% http://apmonitor.com/wiki/index.php/Main/MATLAB
addpath('../apm/')
% server and application
s = 'http://byu.apmonitor.com';
a = 'regression';
% clear any prior application
apm(s,a,'clear all');
% load model and data files
apm_load(s,a,'model.apm');
csv_load(s,a,'data.csv');
% configure parameters to estimate
apm_info(s,a,'FV','a');
apm_info(s,a,'FV','b');
apm_info(s,a,'FV','c');
apm_option(s,a,'a.status',1);
apm_option(s,a,'b.status',1);
apm_option(s,a,'c.status',1);
apm_option(s,a,'nlc.imode',2);
% solve nonlinear regression
output = apm(s,a,'solve');
disp(output)
apm 44.204.252.150_regression <br><pre> ---------------------------------------------------------------- APMonitor, Version 1.0.1 APMonitor Optimization Suite ---------------------------------------------------------------- --------- APM Model Size ------------ Each time step contains Objects : 0 Constants : 0 Variables : 4 Intermediates: 0 Connections : 0 Equations : 2 Residuals : 2 Number of state variables: 16 Number of total equations: - 16 Number of slack variables: - 0 --------------------------------------- Degrees of freedom : 0 ---------------------------------------------- Model Parameter Estimation with APOPT Solver ---------------------------------------------- Iter Objective Convergence 0 0.00000E+00 2.00000E+00 1 0.00000E+00 2.00000E+00 Successful solution --------------------------------------------------- Solver : APOPT (v1.0) Solution time : 1.290000000153668E-002 sec Objective : 0.000000000000000E+000 Successful solution --------------------------------------------------- </pre>
  3 comentarios
Cris LaPierre
Cris LaPierre el 1 de Sept. de 2022
Still can't duplicate. Have you tried asking your question in the APM discussion forum?
Also, you do not need to copy the apm folder. Just use the full path to the original folder in the addpath command. Consider saving the changes to your path so that you do not have to do this every time. See here: https://www.mathworks.com/help/matlab/matlab_env/add-remove-or-reorder-folders-on-the-search-path.html
Birsen Ayaz-Maierhafer
Birsen Ayaz-Maierhafer el 1 de Sept. de 2022
Hi Chris,
I just joined the forum and posted this question in the forum.
Thank you

Iniciar sesión para comentar.

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by