# Insufficient number of outputs from right hand side of equal sign to satisfy assignment

조회 수: 124 (최근 30일)
Ashwin S 2020년 12월 20일
댓글: aldi julio 2021년 9월 28일
clc;
clear all;
define_constants;
tic
global FPA Lb Ub Q1 result
fprintf('\nReal Power Loss Minimization\n');
NB=length(mpc.bus(:, PD));
NL=length(mpc.branch(:, 1));
NG=length(mpc.gen(:,1));
fprintf('\nLoad Flow Analysis Using Newton Raphson Method\n');
opt = mpoption('VERBOSE',0,'OUT_ALL', 0);
results=runpf(mpc,opt);
PL=sum(results.branch(:, PF)+ results.branch(:, PT));
fprintf('\nReal power loss %9.4f MW\n',PL);
fprintf('\nLoss Minimization Using Flower Polination Algorithm\n');
% Dimension of the search variables
Dim=12; popsize=50; N_iter=200;
Lb=[50 20 15 10 10 12 0.95 0.95 0.95 0.95 0.95 0.95];
Ub=[200 80 50 35 30 40 1.1 1.1 1.1 1.1 1.1 1.1];
[result , MinCost] = FPA(Dim,popsize,N_iter,Lb,Ub); // ERROR OCCURS HERE
This program is about using FACTS devices and Flower Pollination Algorithm but when I try to run this code I get error
ERROR:
Insufficient number of outputs from right hand side of equal sign to satisfy assignment.
Error in File (line 21)
[result , MinCost] =FPA(Dim,popsize,N_iter,Lb,Ub);
##### 댓글 수: 4이전 댓글 2개 표시이전 댓글 2개 숨기기
Jan 2020년 12월 20일
On top of the code you have defined FPA as a global variable. Maybe it is an array or a function handle. I cannot guess this detail. If it is a function, read the corresponding documentation, which explains the number of outputs.
Global variables are a bad design, because they cause more troubles then they solve.
aldi julio 2021년 9월 28일
Can i get the code about using fact device?

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

### 답변 (1개)

Abhishek Gupta 2020년 12월 23일
Hi,
As per my understanding, you are getting an 'Insufficient number of outputs from the right-hand side of equal sign to satisfy assignment' error. The error indicates that the right-hand statement, i.e. FPA(), is giving fewer outputs than the number of outputs you are trying to assign, which is [result, MinCost].
The possible workaround for this would be to remove one of the output variables. If you are not sure about the output argument of the function FPA(), it would be best to check out the documentation.

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

### 카테고리

Help CenterFile Exchange에서 Code Performance에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by