Difference between %d, %f, or any other %?
These are formatting control codes. %d prints a number in decimal (base 10) format, useful for integers. %f is for floating point (numbers with parts after the decimal point). See this article for an overview: https://www.mathworks.com/help/matlab/matlab_prog/formatting-strings.html
What does '%' represent?
Depending on the context, it's either a comment character or a formatting control character.
a = sin(pi);
fprintf('Pi is: %5.2f.',pi);
What is the difference between in64, int32, and int8. Are there anymore 'int' functions? (int means integer right?)
Yes, int means integer. The number after it determines how many bits are used to hold the number, which determines the maximum size number it can hold. For instance an int8 has 8 bits of storage space and can hold 256 values (2^8). A 32-bit bit int holds a little bit over 4 billion values. MATLAB uses up to 64-bit precision, available in doubling amounts, so int8, int16, int32, and int64.
There are signed integers (intX) and unsigned integers (uintX). Unsigned will hold that range as all positive values and zero, while signed values will split the range between positive and negative numbers. For the 8-bit types, unsigned range is 0-255, while the signed int will range between -128 and + 127 (256 values, when you include zero).
Best Answer