Why does the NUMEL function give an incorrect answer for a uint8 datatype, when run in my script in MATLAB 6.5.1 (R13SP1)?
2 views (last 30 days)
Show older comments
When I execute the following code I receive the incorrect output value for "a" shown below:
data=uint8(randn(245,352,11))
data_whos = whos( 'data' )
a= numel(data)
data_whos =
name: 'data'
size: [245 352 11]
bytes: 948640
class: 'uint8'
a =
86240
The correct value of "a" should be 245 x 352 x 11=948640.
However, when I run the code through the MATLAB debugger I get the correct answer.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This bug has been fixed in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
This issue has been fixed in MATLAB 7.0 (R14). If you are using an earlier version of MATLAB, read the following:
We have verified that there is a bug in MATLAB 6.5.1 (R13SP1) that affects the way the JIT accelerator handles the NUMEL function for uint8 datatypes.
To work around this issue, try disabling the JIT accelerator temporarily. This can be done as follows:
data=uint8(randn(245,352,11))
data_whos = whos( 'data' )
feature('accel', 'off') % Disabling the accelerator before implementing NUMEL
a= numel(data )
feature('accel', 'on') % Turning the accelerator back to "on"
0 Comments
More Answers (0)
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!