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)

 Akzeptierte Antwort

Guillaume
Guillaume am 8 Okt. 2018

0 Stimmen

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 Kommentare

Jennifer Pyles
Jennifer Pyles am 8 Okt. 2018
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 am 8 Okt. 2018
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by