Unable to perform assignment

DOAest1=asin(sort(-angle(rx(ad([1])))/pi))*180/pi
DOAest2=asin(sort(-angle(rx(ad([3])))/pi))*180/pi
DOAest3=asin(sort(-angle(rx(ad([5])))/pi))*180/pi
est1=[est1 DOAest1];
est2=[est2 DOAest2];
est3=[est3 DOAest3];
est=[est1 est2 est3];
DOAest_RM(1:iwave,i) = sort(est)' Unable to perform assignment because the size of the left side is 3-by-1 and the size of the right side is 6-by-1.

3 Comments

How does the code initialize the est variables?
I have just initialized est ahead,
est[]
est1[]
est2[]
est3[]
Is rx a function that is returning a vector? Or is ad a function that is returning a vector? You must be expecting a non-scalar result from angle() as otherwise you would not bother to sort() what it returns.
Anyhow, you will find that your DOAest* variables are all vectors of length 2.
Or, alternately, in code you did not show here, the code you posted is being executed twice and DOAest* variables are all scalars.
By the time you get to the sort(est) call, est is a vector with 6 elements, but iwave is value 3 so you are trying to assign the 6 values into 3 locations.

Sign in to comment.

Answers (0)

Asked:

on 8 Oct 2020

Commented:

on 8 Oct 2020

Community Treasure Hunt

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

Start Hunting!