Code covered by the BSD License  

Highlights from
String Letter Counter Function

Be the first to rate this file! 5 Downloads (last 30 days) File Size: 1.35 KB File ID: #26295

String Letter Counter Function

by Avinash Rude

 

07 Jan 2010 (Updated 07 Jan 2010)

This function returns comma separated unique letter counts in an input string, keeping the order.

| Watch this File

File Information
Description

Statement: strLetterCounter('string')
....where, 'string' is an input string containing alphabet or numbers.

Ex: string='aaaaaaaabbbbbbccd'
Statement: strLetterCounter(string)
Output: '8a,6b,2c,1d'

Note: This function is different from the Matlab function called 'unique' because it keeps the order in which letters occur in the string.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
12 Jan 2010 Oleg Komarov

Poor preallocation. Complex output. Poor help.
>> strLetterCounter('aaaaaaaabbbbbbccdaaa')
ans =
8a,6b,2c,1d,3a
This fcn counts the length of continues blocks.

Oleg

Please login to add a comment or rating.
Updates
07 Jan 2010

Fixed printing of a local variable.

Tag Activity for this File
Tag Applied By Date/Time
strings Avinash Rude 07 Jan 2010 09:28:11
count strings Avinash Rude 07 Jan 2010 09:28:11
letter count Avinash Rude 07 Jan 2010 09:28:11
numbers Avinash Rude 07 Jan 2010 09:28:12
alphabet count Avinash Rude 07 Jan 2010 09:28:12
string manipulation Avinash Rude 07 Jan 2010 09:28:12
signal processing Avinash Rude 07 Jan 2010 09:28:12

Contact us at files@mathworks.com