Assignment with 0 - Alternative

조회 수: 1 (최근 30일)
BdS
BdS 2019년 4월 30일
Hi everybody,
I have got the following code:
PortMembers=369x1 cell with ISINS
GlData.instrISIN(:,1) = 1640x1 cell with ISIS
rebRankings=NaN(nDates,nPortMembers,nFactors);
% create matrix with rankings on rebalancing dates only
[~,ind]=ismember(PortMembers(:,1),GlBbgRawData.instrISIN(:,1));
rebRankings(dRebInd,:,:)=GlBbgRawData.factorRanks(:,ind,:);
The resulting variable ind contains one 0 because the ISIN xxx in PortMembers is not available in GlData.instrISIN(:,1). In this particular case, it means that ISIN in PortMembers on 'place' 349x1 in not available in GlData.instrISIN(:,1). In such cases I would like to insert NaNs in rebRankings. It means, rebRankings(dRebInd,349,:) would contain NaNs.
Do you know any elegant solutions for those kind of questions? (if possible, no iterations.)
Thanks in advance.

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by