Mapping two matrices

3 次查看(过去 30 天)
Bilen Oytun Peksel
Hi! My question is :
I have two n x n matrices one being pressure levels(SPL) and the other one being the frequency (f) of each and every SPL. Their indices are of course the same since the matrices are identical in shape. I need to sort the f matrix and put it into a 1D vector form and I want the SPL matrix to follow.
How could I do this? Thanks

采纳的回答

Jan
Jan 2011-9-9
[fS, index] = sort(f(:));
out = [fS, SPL(index)];

更多回答(1 个)

Andrei Bobrov
Andrei Bobrov 2011-9-9
out = [f(:) SPL(:)]
with sort
out = sortrows([f(:) SPL(:)],1);
  1 个评论
Bilen Oytun Peksel
Sorry, I should add the f matrix should be ascending. I mean any kind of operation I apply on f should effect SPL identically.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by