Hi all, can someone please explain me how can I fix the error "size inputs must be scalar"?
When I run the code in matlab it works correctly but when i run the compiled exe I obtain this error:
Error using randpermSize inputs must be scalar.Error in randsample (line 162)Error in 'mycode' (line .'indexesWith0=randsample(1:n-sumboo,nToAnalyze-sumboo); % '..)
MATLAB:NonScalarInput nToAnalyze=options.nToAnalyze; if isempty(nToAnalyze) Exclude=''; else if nToAnalyze >n error(['nToAnalyze must be smaller or equal than ' num2str(n)]) end boo=double_y ==1; %
notboo=~boo; % sumboo=sum(boo); % seq=1:n; % indToExtractWith0=seq(notboo); % indexes of units which have 0
indexesWith0=randsample(1:n-sumboo,nToAnalyze-sumboo); %
UnitsToAnalyzeWith0=indToExtractWith0(indexesWith0); % UnitsToanalyze=[seq(boo) UnitsToAnalyzeWith0]; % Exclude=setdiff(seq,UnitsToanalyze); % end
thank you, D.
Best Answer