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 件のコメント

Kasula varshini
Kasula varshini 2021 年 6 月 22 日
error in line 45
how to resolve it
Walter Roberson
Walter Roberson 2021 年 6 月 24 日
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 2021 年 7 月 18 日
I cannot submit all my exercices, error of path in windows!!!? how to repair this? please

サインインしてコメントする。

 採用された回答

Abhishek Malik
Abhishek Malik 2020 年 4 月 22 日
編集済み: Abhishek Malik 2020 年 4 月 22 日

6 投票

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 件のコメント

Tom Mosher
Tom Mosher 2020 年 5 月 2 日
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 2020 年 5 月 25 日
When I click on the zip file , there is only one zip set. Not multiple.
Si Tong Ngo
Si Tong Ngo 2020 年 5 月 29 日
same, is there a way to get the set for matlab?
lavanya s
lavanya s 2020 年 6 月 11 日
i changed it according to the following changes but it did not work for me
Harshad Koshti
Harshad Koshti 2020 年 7 月 21 日
it's not working..
Ivan Belikov
Ivan Belikov 2020 年 8 月 2 日
Also you have to change:
Line 22: response = submitParts(conf, email, token, parts_1);
Line 37: showFeedback(parts_1, response);
Satishkumar Bansode
Satishkumar Bansode 2020 年 8 月 25 日
編集済み: Walter Roberson 2020 年 9 月 14 日
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 2020 年 9 月 9 日
thank you so much ... it works
TIANXIN LI
TIANXIN LI 2020 年 9 月 14 日
It works to me. Thank you!
José Díaz
José Díaz 2020 年 10 月 28 日
It didn't work for me
Mike Ak
Mike Ak 2020 年 12 月 23 日
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 2020 年 12 月 23 日
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 2021 年 4 月 9 日
error in line 94 is coming pls tell
Walter Roberson
Walter Roberson 2021 年 4 月 9 日
編集済み: Walter Roberson 2021 年 4 月 9 日
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 2021 年 4 月 26 日
can u send the code
Ajay Kumar
Ajay Kumar 2021 年 4 月 26 日
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 2021 年 7 月 2 日
Also you have to change:
Line 22: response = submitParts(conf, email, token, parts_1);
Line 37: showFeedback(parts_1, response
Nick Tsui
Nick Tsui 2021 年 8 月 3 日
Thanks!

サインインしてコメントする。

その他の回答 (6 件)

Peter Radi
Peter Radi 2019 年 11 月 11 日

1 投票

Just replace submitWithConfiguration.m's content with a previous version of it (like from ex4).
Nathan Abraham
Nathan Abraham 2020 年 4 月 4 日

1 投票

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 件のコメント

Tom Mosher
Tom Mosher 2020 年 5 月 2 日
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 2020 年 5 月 25 日
I am using zip download from week2

サインインしてコメントする。

Walter Roberson
Walter Roberson 2019 年 9 月 21 日

0 投票

parts is a function defined inside submitWithConfiguration

7 件のコメント

Prakhar Bhatnagar
Prakhar Bhatnagar 2019 年 9 月 21 日
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 2019 年 9 月 21 日
Try giving the command
restoredefaultpath
rehash toolboxcache
and then run the file again
Dan Cav
Dan Cav 2019 年 9 月 25 日
I'm having the same issue, attempted this without success. Has anyone solved this?
Thanks
Walter Roberson
Walter Roberson 2019 年 9 月 25 日
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 2019 年 10 月 12 日
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 2019 年 10 月 13 日
Could you confirm that you are using a submitWithConfiguration.m that defines function parts() around line 93 or so ?
Mansi Patel
Mansi Patel 2019 年 10 月 13 日
編集済み: Mansi Patel 2019 年 10 月 13 日
yes
in line 93 : parts = {};

サインインしてコメントする。

Chris Waweru
Chris Waweru 2020 年 1 月 4 日

0 投票

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 件のコメント

Mike Ak
Mike Ak 2020 年 12 月 23 日
>> 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 2021 年 3 月 30 日
use parts_function(conf)

サインインしてコメントする。

Narendra Wagdarikar
Narendra Wagdarikar 2020 年 8 月 8 日

0 投票

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 件のコメント

Narendra Wagdarikar
Narendra Wagdarikar 2020 年 8 月 8 日
isuue is related to coursera on line matlab assignment submition
Tom Mosher
Tom Mosher 2020 年 8 月 8 日
I recommend that questions on the Coursera "Machine Learning" course be posted on the course's Discussion Forum.
Mike Ak
Mike Ak 2020 年 12 月 23 日
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 2021 年 5 月 20 日
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 2021 年 6 月 20 日
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

サインインしてコメントする。

Neha Ksheerasagar
Neha Ksheerasagar 2021 年 10 月 30 日

0 投票

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

1 件のコメント

Tom Mosher
Tom Mosher 2021 年 10 月 30 日
Please post your question on the Coursera discussion forum.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by