Mapping 2 matrices with different number of columns.

조회 수: 2 (최근 30일)
BdS
BdS 2019년 7월 10일
댓글: BdS 2019년 7월 10일
Hi,
I've got the following 2 matrices and 1 vector
  • UniqFXRates 30x11 double (11 FX rates for 30 data points)
  • InstrFXRates 30x232 double (232 companies for the same 30 data points). The unique FX Rates for the 232 companies are 11
  • IndFX 1x232 double ("indicator" vector which shows the column's index number of UniqFXRates for each instrument) E.g.: [1 5 11 2 4 2 1 3 ...]
The goal is to map the content from UniqFXRates into InstrFXRates using IndFX vector as an indicator.
The following code unfortunatelly does not work.
InstrFXRates(:,IndFX)=UniqFXRates;
A loop does not work as well.
for instr=IndFX
InstrFXRates=UniqFXRates(:,IndFX);
end
Do you have any suggestions?
Thank you in advance
  댓글 수: 1
Guillaume
Guillaume 2019년 7월 10일
The goal is to map the content from UniqFXRates into InstrFXRates
What does that actually mean? Can you give an example of input and desired output?

댓글을 달려면 로그인하십시오.

채택된 답변

Alex Mcaulley
Alex Mcaulley 2019년 7월 10일
Try this:
InstrFXRates = UniqFXRates(:,IndFX)
  댓글 수: 1
BdS
BdS 2019년 7월 10일
It works perfectly! It is impressive what one can do with just 1 line of code...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by