Assignment with 0 - Alternative

1 visualizzazione (ultimi 30 giorni)
BdS
BdS il 30 Apr 2019
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.

Risposte (0)

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by