Assignment with 0 - Alternative

2 次查看(过去 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 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by