Improper assignment error
13 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I wrote the following code: w=10:2:30; b=(-4*w-4); c=(-(w+1).*(-4*w-4)+w+6); d=-2*(w+1).^2-(w+1).^3; f = zeros(1,length(w));
for ii = 1:numel(w) g = roots([b(ii),c(ii),d(ii)]); f(ii) = g(g<1); end
ptr=2./(1+w); u=2./(6+w); l=(u.*(1-ptr.*f).^3)./3; plot(w,l); xlabel('w - contention window size'); ylabel('Normalized throughput'); title('O/p for the case of simple routing'); grid;
------x-------
??? Improper assignment with rectangular empty matrix.
Error in ==> tstsr at 9 f(ii) = g(g<1); ------x------
How to correct this error ?
1 Commento
Risposte (1)
Jan
il 4 Mar 2011
In this line:
f(ii) = g(g<1)
the right hand side is a [1 x 0] vector, while the left hand side expects a scalar. Use the debugger to inspect your code:
dbstop if error
Then dispaly the value of "g(g<1)" in the command window, when the program stops automatically at reaching the error.
0 Commenti
Vedere anche
Categorie
Scopri di più su Debugging and Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!