bitshift Double inputs error
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lefteris Kostakis
am 24 Nov. 2019
Bearbeitet: Lefteris Kostakis
am 24 Nov. 2019
I use this command where A is a 4x4 array and "s" is a dobule (actually it's value is 18.000)
I assume the inputs as int64, then why I get error "Double inputs must have integer values in the range of ASSUMEDTYPE" ?
W = bitshift(A,s-15,'int64');
whos A prints: " A 4x4 128 double "
Edit: I changed the command to "W = bitshift(int64(A),int64(s-15),'int64');"
But is the way to do it ?
0 Kommentare
Akzeptierte Antwort
KALYAN ACHARJYA
am 24 Nov. 2019
Bearbeitet: KALYAN ACHARJYA
am 24 Nov. 2019
A=randi(10,[4 4]);
s=18;
W = bitshift(A,s-15,'int64')
Result:
W =
40 56 32 72
32 16 80 72
64 8 80 48
64 48 24 72
Documentation: If A is an array of signed integers, then bitshift returns the arithmetic shift results, preserving the signed bit when k is negative, and not preserving the signed bit when k is positive.
See simmilar question here
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!