Error using bitset fuction
    1 vue (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
i have value A=46;
i used bitset function to change the second bit ,i get abswer ,but how to change the last 2 bits ,i tried using
X=bitset(A,1:2,1); setting last two bits to one
please help
0 commentaires
Réponse acceptée
  Walter Roberson
      
      
 le 22 Nov 2012
        bitset() is not defined to be able to change two bits at a time.
bitset(bitset(A, 1, 1), 2, 1)
2 commentaires
  Walter Roberson
      
      
 le 22 Nov 2012
				A is only of length 1, so end-2 would be trying to access column -1.
Indexing of numeric data does not access bits.
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Data Import and Analysis dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!