No BSD License  

Highlights from
SCLRCMPRS

Be the first to rate this file! 0 Downloads (last 30 days) File Size: 908 Bytes File ID: #6420

SCLRCMPRS

by Mukhtar Ullah

 

29 Nov 2004 (Updated 27 Jan 2005)

Squeezes nonscalar arrays to scalars, if possible.

| Watch this File

File Information
Description

SCLRCMPRS squeezes nonscalar arrays to scalars, if possible.
SCLRCMPRS(X) returns a scalar element if the array X is only the repetition of this scalar, X otherwise.

[X1,X2,...,Xn] = SCLRCMPRS(X1,X2,...,Xn) replaces non-scalar arrays having the same scalar repeated, with the scalars.

Example:
>> c1 = magic(4); c2 = repmat(2,5); c3 = 15; c4 = [9 9];
>> [c1,c2,c3,c4] = SCLRCMPRS(c1,c2,c3,c4)

c1 =

    16 2 3 13
     5 11 10 8
     9 7 6 12
     4 14 15 1

c2 =

     2

c3 =

     15

c4 =

     9

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
02 Dec 2004

optimised by avoiding DIFF function

27 Jan 2005

Renamed to SCLRCMPRS

Tag Activity for this File
Tag Applied By Date/Time
matrices Mukhtar Ullah 22 Oct 2008 07:36:49
scalar repetition in array Mukhtar Ullah 22 Oct 2008 07:36:49
compress Mukhtar Ullah 22 Oct 2008 07:36:49
squeeze Mukhtar Ullah 22 Oct 2008 07:36:49
matrix Mukhtar Ullah 22 Oct 2008 07:36:49
utilities Mukhtar Ullah 22 Oct 2008 07:36:49

Contact us at files@mathworks.com