Code covered by the BSD License  

Highlights from
num2abc

4.0

4.0 | 1 rating Rate this file 0 Downloads (last 30 days) File Size: 2.05 KB File ID: #14007
image thumbnail

num2abc

by DS

 

19 Feb 2007 (Updated 03 Aug 2007)

Function that translates numbers to spreadsheet column labels.

| Watch this File

File Information
Description

NUM2ABC(X), where X is an integer, returns a string corresponding to the column label commonly employed by spreadsheet programs, such as Microsoft
Excel.

 Example:
       x = 45;
       num2abc(x);

       ans =
           AS

MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
03 Jan 2012 Jinfeng Li

When number>702 it gives an error:
K>> ABCtranslate = num2abc(703)
??? Attempted to access alphabetStrings(27); index out of bounds because
numel(alphabetStrings)=26.

Error in ==> num2abc at 54
        ABCtranslate = ...
 
K>> ABCtranslate = num2abc(702)
ABCtranslate =
ZZ
K>>
You see,it doesn't reach the limitation

Please login to add a comment or rating.
Updates
20 Jun 2007

Included acknowledgment of the complementary function ABC2NUM.

03 Aug 2007

Fixed hole in logic for even multiples of 26. Raised nMax to 16,384.

Tag Activity for this File
Tag Applied By Date/Time
data import DS 22 Oct 2008 09:01:06
data export DS 22 Oct 2008 09:01:06
excel DS 22 Oct 2008 09:01:06
spreadsheet DS 22 Oct 2008 09:01:06
label DS 22 Oct 2008 09:01:06
string conversion DS 22 Oct 2008 09:01:06

Contact us at files@mathworks.com