Save a variable from a for cycle into a matrix

2 ビュー (過去 30 日間)
Miguel Albuquerque
Miguel Albuquerque 2022 年 6 月 12 日
コメント済み: Miguel Albuquerque 2022 年 6 月 12 日
Hey guys, this is probably very easy but Im having troubles.
I have a matrix range_compression(2032x400). Each row corresponds to a position of a radar and columns correspond to signals in frequency domain.
For each column I apply a function that transforms that signal to time domain. However the code I have is saving all of this in a vector 1x 2243277. And I would like to save it in a matrix 2032x400. Thank you all
[nr,mr]=size(Range_compression);
for i=1:mr
[time_compression,range_compressed]=freq2time(i,doppler_freqSurv);
end
time_compression=time_compression*c;

回答 (1 件)

Image Analyst
Image Analyst 2022 年 6 月 12 日
Maybe this:
[rows,columns]=size(Range_compression);
output = zeros(rows, columns);
for col = 1 : columns
% Get a column
thisColumn = Range_compression(:, col);
% Convert it to time domain.
[time_compression,range_compressed]=freq2time(col, thisColumn);
% Save the output (whichever vector it is)
output(:, col) = time_compression; % Or whatever...
end
If you have any more questions, then attach your data, the freq2time function, and code to read the data in with the paperclip icon after you read this:
  1 件のコメント
Miguel Albuquerque
Miguel Albuquerque 2022 年 6 月 12 日
Thank you for helping me , With that code I get this error. I attached the variables and the function freq2time
[rows,columns]=size(Range_compression);
output = zeros(rows, columns);
for col = 1 : columns
% Convert it to time domain.
[time_compression,range_compressed]=freq2time(col, doppler_freqSurv);
% Save the output (whichever vector it is)
output(:, col) = range_compressed; % Or whatever...
end
Unable to perform assignment because the size of the left side is 2032-by-1 and the size of the right side is 1-by-2243277.

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

カテゴリ

Help Center および File ExchangeData Preprocessing についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by