# RANDBLOCK (Scripts) 2.3

Average Rating
User Rating:
Visitors Rating:
My rating:

See full specifications

## RANDBLOCK (Scripts) Publisher's description

### RANDBLOCK - randomize blocks of a matrix

RANDBLOCK - randomize blocks of a matrix

R = RANDBLOCK(M,S) randomizes the matrix M by dividing M into non-overlapping blocks of the size specified by S, and shuffling these blocks. M can be a N-D matrix.

The number of elements in S should match the number of dimensions of M, or S can be a scalar specifying a S-by-S-by-S-by ... block size. S should contain positive integers. The size of M in any dimension should be an integer number of times the specified size of the block in that dimension (e.g., if size(M,1) equals 6, S(dim) can be 1,2,3, or 6).

[R,I,J] = RANDBLOCK(...) also returns indices I and J, so that R equals A(I)and R(J) equals A.

M can be a numerical or cell array.

Examples:
% Shuffle blocks of 3 elements of a 15-element vector
M = 1:15 ;
randblock(M,3)

% Scramble a 2D matrix
M = reshape(1:24,4,[]) ;
randblock(A,[3 2]) % randomize the position of the four 3-by-2 blocks
randblock(A,2) % randomize the position of the six 2-by-2 blocks

% Scramble a 3D volume
M = reshape(1:64,[4 8 2]) ;
randblock(A,[2 4 2]) % randomize the position of the four
% 2-by-4-by-2 sub-volumes
% Scramble a cell matrix
M = {'1','a','bb','1c' ; '2a',[3 4 5],'2c','2dd'} ;
randblock(M,[2 2]) % randomize the position of the four 2-by-2 blocks

% Scramble a RGB image Z, and retrieve the original using the
% indices (see the SCREENSHOT)
Z = peaks(200) ; Z = cat(3,Z,flipud(Z), -(circshift(Z.',[100,100]))) ;
Z = (Z - min(Z(:))) ; Z = Z./ max(Z(:)) ;
[Z2,I,J] = randblock(Z,[25,25,size(Z,3)]) ; % Scramble 25-by-25 blocks
subplot(2,2,1) ; image(Z) ; title('Original image') ;
subplot(2,2,2) ; image(Z2) ; title('25x25 scrambled image') ;
subplot(2,2,3) ; image(Z2(J)) ; title('Z2(J) = original image') ;
subplot(2,2,4) ; image(Z(I)) ; title('Z(I) = scrambled image') ;
set (gcf,'Name','[Z2,I,J] = randblock(Z,[25,25,size(Z,3)])') ;

#### System Requirements:

MATLAB 6.5 (R13)
Program Release Status: New Release
Program Install Support: Install and Uninstall

#### RANDBLOCK (Scripts) Tags:

Click on a tag to find related softwares

## Most Popular

ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation 1.1
ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation contain several functions for digital modulation simulation
Simulink Communication Labs 1.1
Simulink Communication Labs allows you to learn communication systems in greater depth.
M-QAM modulation and demodulation 1.1
M-QAM modulation and demodulation is the QAM modulation and demodulation tech.
LZW Compression/Decompression 1.1
LZW Compression/Decompression - Updated LZW compressor and decompressor with reasonable performance
InSPIRE utility to plot a 2D displacement field (Scripts) 1.0
This program plots the deformation field (displace vectors) contained in vector.txt.