How can we write unsigned long value in matlab?
Show older comments
Hi there, I am trying to implement some steps from a C code and there is this "(double)" "(unsigned long)" thing which I really don't have any idea about. Can anyone please guide me if I have to write the exact code in matlab what would be the syntax?
Here is the example of the line that I wanted to implement

Accepted Answer
More Answers (1)
As I understand it, this would be a casting operation, equivalent to the Matlab function cast. (note that typecast changes the data type, but not the underlying bits, while cast will try to find the closest equivalent)
Since an unsigned long is an 8 byte integer, on systems with 8 bits per byte (virtually every computer nowadays), that amounts to 64 bits. So that would make it a uint64 in Matlab.
doc cast
doc typecast
2 Comments
Imtiaz nabi
on 24 Feb 2022
Rik
on 24 Feb 2022
I suspect that's correct.
Your question doesn't actually seem a Matlab question. I looks like you don't understand the C code.
I hardly ever work with C. I suspect that '30UL' is casting the value 30 to an unsigned long, but I don't know.
Categories
Find more on Logical 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!