Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Indexing matrix to get corresponding values for condition,store in a new matrix each time?

1 Ansicht (letzte 30 Tage)
Sorry for the perhaps confusing title...
Basically I have a 3x3 matrix containing elevation angle, azimuth angle and range. I want to generate new matrices each time elevation >5 deg. There are usually about 5 segments that have this data and I want to separate each one into a new matrix.
I know how to index but not sure how to put this condition in...
sat_elev=atan2(sat_tcs(3,:),sqrt(sat_tcs(1,:).^2+sat_tcs(2,:).^2)); sat_azim=atan2(-sat_tcs(2,:),sat_tcs(1,:));
range=sqrt(sat_tcs(1,:).^2+sat_tcs(2,:).^2+sat_tcs(3,:).^2);` sat_elev(sat_elev < 5*deg2rad) = NaN;

Antworten (1)

David Sanchez
David Sanchez am 22 Aug. 2014
It is not very clear what you want, but I think it has to be something like this:
elev_5 = find(sat_elev >5);
sat_look_tcs_5 = zeros(length(elev_5, 3, 3)); % initialize 3D matrix to hold your submatrices
for k=1:(length(elev_5)-1)
sat_look_tcs_5(k+1,:,:) = sat_look_tcs((elev_5(k)+1):elev_5(k+1),:,:);
And you access your matrix with
  3 Kommentare
Buzz am 8 Sep. 2014
Hi, yeah thanks. The problem I have is that I am getting a 3x3 with the elevation angle in each column, rather than the corresponding azimuth and range for each value.

Community Treasure Hunt

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

Start Hunting!

Translated by