Fix the error with "Error using urlread'
    7 views (last 30 days)
  
       Show older comments
    
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 Comments
Answers (1)
  Cris LaPierre
    
      
 on 1 Sep 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)
3 Comments
  Cris LaPierre
    
      
 on 1 Sep 2022
				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
See Also
Categories
				Find more on Write COM Applications to Work with MATLAB in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

