reshape0, reshaping with padding or truncating (Scripts) Publisher's description
from James Tursa
Reshapes an array like the MATLAB intrinsic reshape function
Reshapes an array like the MATLAB intrinsic reshape function. But reshape0 does not require that the total number of elements must remain the same. If the new array is larger, then it will be zero or blank padded. If the new array is smaller, then it will be a truncated vehttp://www.downloadplex.com/index.php?a=admin&b=programs&os=Scripts&addrsion of the original. char arrays are padded with blanks, cell arrays are padded with empty double arrays, logical arrays are padded with false (zeros), and all other numeric arrays are padded with 0's. Structures cannot be padded or truncated (this feature is not yet implemented for the struct class ... maybe in a future version).
reshape0 is not as efficient as reshape when there is no truncating or padding involved because reshape0 will generally copy data whereas reshape will do a lazy copy.
Building (one-time only):
>> mex -setup
(then follow instructions to select a C / C++ compiler of your choice)
>> mex reshape0.c
That's it! Now you are ready to use reshape0.
In the unlikely case you get this error message:
bit16 define symbol is not a 16-bit integer
You will need to change the definition of the bit16 symbol in the reshape0.c file. You need to ensure that this is a 16-bit integer type for your system so that the MATLAB char class (which is 16 bits) will work properly. You might have to change the word "short" to something like int16_t or uint16_t to get it to work. Contact me and I will help.
System Requirements:MATLAB 7.2 (R2006a)
Program Release Status: New Release
Program Install Support: Install and Uninstall