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.

2 views (last 30 days)
Hey guys, thanks in advance
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 getting this error
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.
I would like to save the outputs of the function in a matrix 2243277x400(columns of range_compression). How can I solve this error?
Thanks a lot
[rows,columns]=size(Range_compression);
output = zeros(rows, columns);
for col = 190 : 300
% Get a column
thisColumn = Range_compression(:, col);
% Convert it to time domain.
[time_compression,range_compressed]=freq2time(thisColumn, doppler_freqSurv);
% Save the output
time_compression=time_compression*c;
output(:, col)= time_compression;
output2(:, col)= range_compressed;
end
  3 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 12 Jun 2022
f=linspace(-max_f,max_f,2*max_f*(length(Fsig)-1)/(max(Fsig)-min(Fsig))+1);
linspace with two parameters always generates 100 points
t=linspace(-0.5/(f(2)-f(1)),0.5/(f(2)-f(1)),length(f)+1);
t=t(1:end-1);
One longer than f but throw away one, so t is the same length as f which is 100. t is the first output of freq2time so the first output will be 1 x 100.
[time_compression,range_compressed]=freq2time(thisColumn, doppler_freqSurv);
% Save the output
time_compression=time_compression*c;
output(:, col)= time_compression;
With time_compression being that vector length 100, then the assignment into output can only work if output has 100 rows.
[rows,columns]=size(Range_compression);
output = zeros(rows, columns);
not impossible but seems unlikely.
  3 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by