how to store values in a single array

4 ビュー (過去 30 日間)
Sad Tal
Sad Tal 2014 年 8 月 19 日
コメント済み: Michael Haderlein 2014 年 8 月 19 日
This is a part of my code. i want to store the end values of rec_sr in a single array. How to do it?? Please help.
rec_sr=(h(1,:)).*trans+n(1,:); % Source to Relay Transmission
rec_sr_re = real(rec_sr); % real
rec_sr_im = imag(rec_sr); % imaginary
rec_srHat(find(rec_sr_re < 0 & rec_sr_im < 0)) = -1 + -1*j;
rec_srHat(find(rec_sr_re >= 0 & rec_sr_im > 0)) = 1 + 1*j;
rec_srHat(find(rec_sr_re < 0 & rec_sr_im >= 0)) = -1 + 1*j;
rec_srHat(find(rec_sr_re >= 0 & rec_sr_im < 0)) = 1 - 1*j;
  1 件のコメント
Michael Haderlein
Michael Haderlein 2014 年 8 月 19 日
What do you mean with "end value s"? rec_sr seems to be a one-dimensional array, so there's only one last value. Or do you mean the imag and the real part of the end value? Then it's just
last_entry=[real(rec_sr) imag(rec_sr)].
If you need it quite often, you cut put that into an anonymous function like
real_imag=@(x) [real(x),imag(x)];
last_entry=real_imag(rec_sr(end));

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by