Assignment with 0 - Alternative
조회 수: 1 (최근 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
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!