submit
'parts' requires one of the following:
Navigation Toolbox
Robotics System Toolbox
Sensor Fusion and Tracking Toolbox
Error in submitWithConfiguration (line 4)
parts = parts(conf);
Error in submit (line 30)
submitWithConfiguration(conf);

3 comentarios

Kasula varshini
Kasula varshini el 22 de Jun. de 2021
error in line 45
how to resolve it
Walter Roberson
Walter Roberson el 24 de Jun. de 2021
Install one of: Navigation Toolbox, Robotics System Toolbox, or Sensor Fusion and Tracking Toolbox. That will resolve the error. (You would then get a different error.)
The permanent solution is as others have describe:
  • download repaired files from your course software; or
  • edit the code so that it does not use parts as both a variable and the name of a function.
Mohammed Lafoui
Mohammed Lafoui el 18 de Jul. de 2021
I cannot submit all my exercices, error of path in windows!!!? how to repair this? please

Iniciar sesión para comentar.

 Respuesta aceptada

Abhishek Malik
Abhishek Malik el 22 de Abr. de 2020
Editada: Abhishek Malik el 22 de Abr. de 2020

6 votos

This is happening because variable parts has the same name as of parts(conf) function in file ex1/lib/submitWithConfiguration.m
Make the following changes to resolve this :
Line 4 - parts_1 = parts(conf);
Line 92 - function [parts_1] = parts(conf)
Line 93 - parts_1 = {};
Line 98 - parts_1{end + 1} = part;
Basically, I've just renamed the variables.
Same thing is happening with one more variable, so make the following changes :
Line 66 - submissionUrl_1 = submissionUrl();
Line 68 - responseBody = getResponse(submissionUrl_1, body);
This should work!

18 comentarios

Tom Mosher
Tom Mosher el 2 de Mayo de 2020
I recommend you not change the script files.
Instead, download the correct set from the course resources.
There are different sets for MATlAB and Octave users.
Ramon Andino
Ramon Andino el 25 de Mayo de 2020
When I click on the zip file , there is only one zip set. Not multiple.
Si Tong Ngo
Si Tong Ngo el 29 de Mayo de 2020
same, is there a way to get the set for matlab?
lavanya s
lavanya s el 11 de Jun. de 2020
i changed it according to the following changes but it did not work for me
Harshad Koshti
Harshad Koshti el 21 de Jul. de 2020
it's not working..
Ivan Belikov
Ivan Belikov el 2 de Ag. de 2020
Also you have to change:
Line 22: response = submitParts(conf, email, token, parts_1);
Line 37: showFeedback(parts_1, response);
Satishkumar Bansode
Satishkumar Bansode el 25 de Ag. de 2020
Editada: Walter Roberson el 14 de Sept. de 2020
please replace the following code for ex1/lib/submitWithConfiguration.m. this will work 100%
function submitWithConfiguration(conf)
addpath('./lib/jsonlab');
parts_1 = parts(conf);
fprintf('== Submitting solutions | %s...\n', conf.itemName);
tokenFile = 'token.mat';
if exist(tokenFile, 'file')
load(tokenFile);
[email token] = promptToken(email, token, tokenFile);
else
[email token] = promptToken('', '', tokenFile);
end
if isempty(token)
fprintf('!! Submission Cancelled\n');
return
end
try
response = submitParts(conf, email, token, parts_1);
catch
e = lasterror();
fprintf('\n!! Submission failed: %s\n', e.message);
fprintf('\n\nFunction: %s\nFileName: %s\nLineNumber: %d\n', ...
e.stack(1,1).name, e.stack(1,1).file, e.stack(1,1).line);
fprintf('\nPlease correct your code and resubmit.\n');
return
end
if isfield(response, 'errorMessage')
fprintf('!! Submission failed: %s\n', response.errorMessage);
elseif isfield(response, 'errorCode')
fprintf('!! Submission failed: %s\n', response.message);
else
showFeedback(parts_1, response);
save(tokenFile, 'email', 'token');
end
end
function [email token] = promptToken(email, existingToken, tokenFile)
if (~isempty(email) && ~isempty(existingToken))
prompt = sprintf( ...
'Use token from last successful submission (%s)? (Y/n): ', ...
email);
reenter = input(prompt, 's');
if (isempty(reenter) || reenter(1) == 'Y' || reenter(1) == 'y')
token = existingToken;
return;
else
delete(tokenFile);
end
end
email = input('Login (email address): ', 's');
token = input('Token: ', 's');
end
function isValid = isValidPartOptionIndex(partOptions, i)
isValid = (~isempty(i)) && (1 <= i) && (i <= numel(partOptions));
end
function response = submitParts(conf, email, token, parts)
body = makePostBody(conf, email, token, parts);
submissionUrl_1 = submissionUrl();
responseBody = getResponse(submissionUrl_1, body);
jsonResponse = validateResponse(responseBody);
response = loadjson(jsonResponse);
end
function body = makePostBody(conf, email, token, parts)
bodyStruct.assignmentSlug = conf.assignmentSlug;
bodyStruct.submitterEmail = email;
bodyStruct.secret = token;
bodyStruct.parts = makePartsStruct(conf, parts);
opt.Compact = 1;
body = savejson('', bodyStruct, opt);
end
function partsStruct = makePartsStruct(conf, parts)
for part = parts
partId = part{:}.id;
fieldName = makeValidFieldName(partId);
outputStruct.output = conf.output(partId);
partsStruct.(fieldName) = outputStruct;
end
end
function [parts_1] = parts(conf)
parts_1 = {};
for partArray = conf.partArrays
part.id = partArray{:}{1};
part.sourceFiles = partArray{:}{2};
part.name = partArray{:}{3};
parts_1{end + 1} = part;
end
end
function showFeedback(parts, response)
fprintf('== \n');
fprintf('== %43s | %9s | %-s\n', 'Part Name', 'Score', 'Feedback');
fprintf('== %43s | %9s | %-s\n', '---------', '-----', '--------');
for part = parts
score = '';
partFeedback = '';
partFeedback = response.partFeedbacks.(makeValidFieldName(part{:}.id));
partEvaluation = response.partEvaluations.(makeValidFieldName(part{:}.id));
score = sprintf('%d / %3d', partEvaluation.score, partEvaluation.maxScore);
fprintf('== %43s | %9s | %-s\n', part{:}.name, score, partFeedback);
end
evaluation = response.evaluation;
totalScore = sprintf('%d / %d', evaluation.score, evaluation.maxScore);
fprintf('== --------------------------------\n');
fprintf('== %43s | %9s | %-s\n', '', totalScore, '');
fprintf('== \n');
end
% use urlread or curl to send submit results to the grader and get a response
function response = getResponse(url, body)
% try using urlread() and a secure connection
params = {'jsonBody', body};
[response, success] = urlread(url, 'post', params);
if (success == 0)
% urlread didn't work, try curl & the peer certificate patch
if ispc
% testing note: use 'jsonBody =' for a test case
json_command = sprintf('echo jsonBody=%s | curl -k -X POST -d @- %s', body, url);
else
% it's linux/OS X, so use the other form
json_command = sprintf('echo ''jsonBody=%s'' | curl -k -X POST -d @- %s', body, url);
end
% get the response body for the peer certificate patch method
[code, response] = system(json_command);
% test the success code
if (code ~= 0)
fprintf('[error] submission with curl() was not successful\n');
end
end
end
% validate the grader's response
function response = validateResponse(resp)
% test if the response is json or an HTML page
isJson = length(resp) > 0 && resp(1) == '{';
isHtml = findstr(lower(resp), '<html');
if (isJson)
response = resp;
elseif (isHtml)
% the response is html, so it's probably an error message
printHTMLContents(resp);
error('Grader response is an HTML message');
else
error('Grader sent no response');
end
end
% parse a HTML response and print it's contents
function printHTMLContents(response)
strippedResponse = regexprep(response, '<[^>]+>', ' ');
strippedResponse = regexprep(strippedResponse, '[\t ]+', ' ');
fprintf(strippedResponse);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Service configuration
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function submissionUrl = submissionUrl()
submissionUrl = 'https://www-origin.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1';
end
KAOUTAR MOUHCINE
KAOUTAR MOUHCINE el 9 de Sept. de 2020
thank you so much ... it works
TIANXIN LI
TIANXIN LI el 14 de Sept. de 2020
It works to me. Thank you!
José Díaz
José Díaz el 28 de Oct. de 2020
It didn't work for me
Mike Ak
Mike Ak el 23 de Dic. de 2020
I did change all above but still get below error
>> submitWithConfiguration
Not enough input arguments.
Error in submitWithConfiguration (line 4)
parts_1 = parts(conf);
Mike Ak
Mike Ak el 23 de Dic. de 2020
I get the same error too even i did follow all above gudlines
>> submitWithConfiguration
Not enough input arguments.
Error in submitWithConfiguration (line 191)
parts_1 = parts(conf);
urvi vasisht
urvi vasisht el 9 de Abr. de 2021
error in line 94 is coming pls tell
Walter Roberson
Walter Roberson el 9 de Abr. de 2021
Editada: Walter Roberson el 9 de Abr. de 2021
You need to name a struct when you call submitWithConfiguration -- the "configuration" that you are submitting with! You cannot just call submitWithConfiguration by itself. The submit() function builds the configuration for you
Ajay Kumar
Ajay Kumar el 26 de Abr. de 2021
can u send the code
Ajay Kumar
Ajay Kumar el 26 de Abr. de 2021
Warning: Function Warning: Name is nonexistent or not a directory: /MATLAB Drive/./lib/jsonlab
> In path (line 109)
In addpath (line 86)
In addpath (line 49)
In submitWithConfiguration (line 2)
'parts' requires one of the following:
Automated Driving Toolbox
Navigation Toolbox
Robotics System Toolbox
Sensor Fusion and Tracking Toolbox
UAV Toolbox
Error in submitWithConfiguration (line 4)
parts = parts(conf);
getting this error can anyone resolve it
Amitabh Kant
Amitabh Kant el 2 de Jul. de 2021
Also you have to change:
Line 22: response = submitParts(conf, email, token, parts_1);
Line 37: showFeedback(parts_1, response
Nick Tsui
Nick Tsui el 3 de Ag. de 2021
Thanks!

Iniciar sesión para comentar.

Más respuestas (6)

Peter Radi
Peter Radi el 11 de Nov. de 2019

1 voto

Just replace submitWithConfiguration.m's content with a previous version of it (like from ex4).
Nathan Abraham
Nathan Abraham el 4 de Abr. de 2020

1 voto

I changed the name of the function parts() to parts_1(). Try doing the same for the definition and the call for the function.
It seems that the name of the function parts in MATLAB is dedicated name to some other toolbox.
It worked for me.
Tnx

2 comentarios

Tom Mosher
Tom Mosher el 2 de Mayo de 2020
Better to download the correct set of programming exercise script files.
There are two sets available. MATLAB users should get the ones from the setup instructions for MATLAB Online in Week 2.
Ramon Andino
Ramon Andino el 25 de Mayo de 2020
I am using zip download from week2

Iniciar sesión para comentar.

Walter Roberson
Walter Roberson el 21 de Sept. de 2019

0 votos

parts is a function defined inside submitWithConfiguration

7 comentarios

Prakhar Bhatnagar
Prakhar Bhatnagar el 21 de Sept. de 2019
I know, even I have the same file in the same path. But want to know why it is executing normally. As I have just downloaded and uploaded the zip file on matlab online and after unzipping I am trying to submit the code.
function submitWithConfiguration(conf)
% Note: has the "certificate" patch from Liran for Windows-like systems
addpath('./lib/jsonlab');
%keyboard
parts = parts(conf);
fprintf('== Submitting solutions | %s...\n', conf.itemName);
tokenFile = 'token.mat';
if exist(tokenFile, 'file')
load(tokenFile);
[email token] = promptToken(email, token, tokenFile);
else
[email token] = promptToken('', '', tokenFile);
end
if isempty(token)
fprintf('!! Submission Cancelled\n');
return
end
try
response = submitParts(conf, email, token, parts);
catch
e = lasterror();
fprintf( ...
'!! Submission failed: unexpected error: %s\n', ...
e.message);
fprintf('!! Please try again later.\n');
return
end
if isfield(response, 'errorMessage')
fprintf('!! Submission failed: %s\n', response.errorMessage);
else
showFeedback(parts, response);
save(tokenFile, 'email', 'token');
end
end
function [email token] = promptToken(email, existingToken, tokenFile)
if (~isempty(email) && ~isempty(existingToken))
prompt = sprintf( ...
'Use token from last successful submission (%s)? (Y/n): ', ...
email);
reenter = input(prompt, 's');
if (isempty(reenter) || reenter(1) == 'Y' || reenter(1) == 'y')
token = existingToken;
return;
else
delete(tokenFile);
end
end
email = input('Login (email address): ', 's');
token = input('Token: ', 's');
end
function isValid = isValidPartOptionIndex(partOptions, i)
isValid = (~isempty(i)) && (1 <= i) && (i <= numel(partOptions));
end
function response = submitParts(conf, email, token, parts)
body = makePostBody(conf, email, token, parts);
submissionUrl = submissionUrl();
params = {'jsonBody', body};
%responseBody = urlread(submissionUrl, 'post', params);
[code, responseBody] = system(sprintf('echo jsonBody=%s | curl -k -X POST -d @- %s', body, submissionUrl));
response = loadjson(responseBody);
end
function body = makePostBody(conf, email, token, parts)
bodyStruct.assignmentSlug = conf.assignmentSlug;
bodyStruct.submitterEmail = email;
bodyStruct.secret = token;
bodyStruct.parts = makePartsStruct(conf, parts);
opt.Compact = 1;
body = savejson('', bodyStruct, opt);
end
function partsStruct = makePartsStruct(conf, parts)
for part = parts
partId = part{:}.id;
fieldName = makeValidFieldName(partId);
outputStruct.output = conf.output(partId);
partsStruct.(fieldName) = outputStruct;
end
end
function [parts] = parts(conf)
parts = {};
for partArray = conf.partArrays
part.id = partArray{:}{1};
part.sourceFiles = partArray{:}{2};
part.name = partArray{:}{3};
parts{end + 1} = part;
end
end
function showFeedback(parts, response)
fprintf('== \n');
fprintf('== %43s | %9s | %-s\n', 'Part Name', 'Score', 'Feedback');
fprintf('== %43s | %9s | %-s\n', '---------', '-----', '--------');
for part = parts
score = '';
partFeedback = '';
partFeedback = response.partFeedbacks.(makeValidFieldName(part{:}.id));
partEvaluation = response.partEvaluations.(makeValidFieldName(part{:}.id));
score = sprintf('%d / %3d', partEvaluation.score, partEvaluation.maxScore);
fprintf('== %43s | %9s | %-s\n', part{:}.name, score, partFeedback);
end
evaluation = response.evaluation;
totalScore = sprintf('%d / %d', evaluation.score, evaluation.maxScore);
fprintf('== --------------------------------\n');
fprintf('== %43s | %9s | %-s\n', '', totalScore, '');
fprintf('== \n');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Service configuration
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function submissionUrl = submissionUrl()
submissionUrl = 'https://www-origin.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1';
end
Walter Roberson
Walter Roberson el 21 de Sept. de 2019
Try giving the command
restoredefaultpath
rehash toolboxcache
and then run the file again
Dan Cav
Dan Cav el 25 de Sept. de 2019
I'm having the same issue, attempted this without success. Has anyone solved this?
Thanks
Walter Roberson
Walter Roberson el 25 de Sept. de 2019
Dan Cav:
Could you confirm that you are using a submitWithConfiguration.m that defines function parts() around line 93 or so, and yet submitWithConfiguration is not able to find parts ?
What shows up for
which -all submitWithConfiguration
Mansi Patel
Mansi Patel el 12 de Oct. de 2019
hii,
I am getting the same error. I tried this command and its showing nothing.
still struggling for the right answer.
Please help.
thank you.
Walter Roberson
Walter Roberson el 13 de Oct. de 2019
Could you confirm that you are using a submitWithConfiguration.m that defines function parts() around line 93 or so ?
Mansi Patel
Mansi Patel el 13 de Oct. de 2019
Editada: Mansi Patel el 13 de Oct. de 2019
yes
in line 93 : parts = {};

Iniciar sesión para comentar.

Chris Waweru
Chris Waweru el 4 de En. de 2020

0 votos

Hi am getting the same error. Someone please help.
submit()
'parts' requires one of the following:
Navigation Toolbox
Robotics System Toolbox
Sensor Fusion and Tracking Toolbox
Error in submitWithConfiguration (line 4)
parts = parts(conf);
Error in submit (line 45)
submitWithConfiguration(conf);
submit()
'parts' requires one of the following:
Navigation Toolbox
Robotics System Toolbox
Sensor Fusion and Tracking Toolbox
Error in submitWithConfiguration (line 4)
parts = parts(conf);
Error in submit (line 45)
submitWithConfiguration(conf);

3 comentarios

Mike Ak
Mike Ak el 23 de Dic. de 2020
>> submitWithConfiguration
'parts' requires one of the following:
Automated Driving Toolbox
Navigation Toolbox
Robotics System Toolbox
Sensor Fusion and Tracking Toolbox
UAV Toolbox
Error in submitWithConfiguration (line 5)
parts = parts(conf);
Sai Tarun
Sai Tarun el 30 de Mzo. de 2021
use parts_function(conf)

Iniciar sesión para comentar.

Narendra Wagdarikar
Narendra Wagdarikar el 8 de Ag. de 2020

0 votos

submit()
'parts' requires one of the following:
Automated Driving Toolbox
Navigation Toolbox
Robotics System Toolbox
Sensor Fusion and Tracking Toolbox
Error in submitWithConfiguration (line 4)
parts = parts(conf);
Error in submit (line 40)
submitWithConfiguration(conf);

5 comentarios

Narendra Wagdarikar
Narendra Wagdarikar el 8 de Ag. de 2020
isuue is related to coursera on line matlab assignment submition
Tom Mosher
Tom Mosher el 8 de Ag. de 2020
I recommend that questions on the Coursera "Machine Learning" course be posted on the course's Discussion Forum.
Mike Ak
Mike Ak el 23 de Dic. de 2020
I am trying to sumbit my assignment in Ng's Machine learning course using Matlab R2020b but get below error. It wont let me to the step of entering login email and token password. pls advise how to fix it.
>> submit()
'parts' requires one of the following:
Automated Driving Toolbox
Navigation Toolbox
Robotics System Toolbox
Sensor Fusion and Tracking Toolbox
UAV Toolbox
Error in submitWithConfiguration (line 4)
parts = parts(conf);
Error in submit (line 45)
submitWithConfiguration(conf);
Nimisha Nupur
Nimisha Nupur el 20 de Mayo de 2021
Hi,
I followed the directions where I changed parts to parts_1, but when I submitted I get the following error.
Function: parts
FileName: /MATLAB Drive/machine-learning-ex3/ex3/lib/submitWithConfiguration.m
LineNumber: 94
Please correct your code and resubmit.
fline num 94 is :
for partArray = conf.partArrays
vishnu vardhan sreerlavancha
vishnu vardhan sreerlavancha el 20 de Jun. de 2021
Hi Nimisha,
Please check all the references of 'parts' variable and replace in all places.
And also check 'submissionUrl = submissionUrl()'
replace 'submissionUrl_1 = submissionUrl()'
Check all the refences where we are calling submissionUrl and replace with submissionUrl_1
Hope this is helpful.
Thank you

Iniciar sesión para comentar.

Neha Ksheerasagar
Neha Ksheerasagar el 30 de Oct. de 2021

0 votos

Function: makePostBody
FileName: /MATLAB Drive/3XAKHIYlRiuwChyGJQYrRw_f1356b38f0f341e89cfc3b3b44ae8ff1_ex2-octave/lib/submitWithConfiguration.m
LineNumber: 74
how to solve this...getting this error while submitting

1 comentario

Tom Mosher
Tom Mosher el 30 de Oct. de 2021
Please post your question on the Coursera discussion forum.

Iniciar sesión para comentar.

Etiquetas

Preguntada:

el 20 de Sept. de 2019

Comentada:

el 30 de Oct. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by