Fix the error with "Error using urlread'
3 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
回答(1 个)
Cris LaPierre
2022-9-1
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)
3 个评论
Cris LaPierre
2022-9-1
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!