Error: File: gaplsopt.m Line: 21 Column: 37
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or
other syntax error. To construct matrices, use brackets instead of parentheses.
The following is line 21 of the code:
function [progr]=gaplsopt(GAdataset,2) %,nvar,evaluat,freqb,endb,runs)
For reference:
% The syntax is: [progr]=gaplsopt(dataset,el)
% where progr=matrix of the progress of the GA in the different runs
%
% The y variable is the last one
%
% This version has no interactive input, and therefore repeated series
% of runs can be performed.
% 2 input parameters have to be specified:
% 1) data set
% 2) type of elaboration (1=random. test, 2=optimization)

 채택된 답변

Guillaume
Guillaume 2018년 10월 8일

0 개 추천

I suspect that you modified an existing function in the mistaken belief you could replace some inputs with constants. The 2 in
function [progr]=gaplsopt(GAdataset,2)
is not valid. You can only put names of input variables in the < https://www.mathworks.com/help/matlab/matlab_prog/create-functions-in-files.html signature of a function>
Restore the function to what it was, and instead call the function passing it your 2 constant, e.g.:
%call to gaplsopt:
somevar = gaplsopt(someothervar, 2)

댓글 수: 2

Jennifer Pyles
Jennifer Pyles 2018년 10월 8일
Thank you for your help I have actually fixed this error and now have a new one if you know how to help with it:
Attempt to execute SCRIPT plsgacv as a function: C:\Users\jenni\plsgacv.m Error in gaplsopt (line 50) [maxcomp,start,mxi,sxi,~,~]=plsgacv(dataset(:,1:v),y,aut,ng,15);
Guillaume
Guillaume 2018년 10월 8일
A common cause for this error is that you've named your script the same name as the function plsgacv. If that's not it, then show its code. Clearly, according to that line 50, plsgacv should be a function, so if it is a script that's certainly not going to work.

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

추가 답변 (0개)

카테고리

질문:

2018년 10월 8일

댓글:

2018년 10월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by