How to solve "Indexing cannot yield multiple results."
3 views (last 30 days)
Show older comments
I'm trying to construct a basic OFDM simulation, and run into some problems when I trying to demodulate the signal to digit number.
the error is in last line 4 with min function.
%remove CP
Rsig=Rxsig(1,Ncp+1:end);
sig=fft(Rsig,N); %singal=<1x128>,128 is the subcarrier number
%demodulation
for jj=1:N
sig4=[sig(1,jj) sig(1,jj) sig(1,jj) sig(1,jj)];
[min, pos]=min(floor((abs(sig4-temp)*1000)'));
% find the nearest signal
% temp=(1/sqrt(2))*[1+1j 1-1j -1+1j -1-1j];
end
or is there a better way to demodulate the signal ? Thank you for answering !!!
0 Comments
Accepted Answer
Walter Roberson
on 13 Aug 2015
Edited: Stephen23
on 13 Aug 2015
In your loop, you call the MATLAB min() function, and you assign the output to [min, pos]. This makes min a numeric variable where it used to be a call to the MATLAB function. Then in the second iteration of the "for" you are indexing the numeric variable because that's what min is now, and you are expecting to be able to get two outputs, [min, pos]. But indexing of something using () only gives you a single output never two outputs, so MATLAB complains.
To fix this... don't name your variables the same thing as MATLAB routines!
2 Comments
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!