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

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.

댓글을 달려면 로그인하십시오.

질문:

2019년 9월 20일

댓글:

2021년 10월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by