COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

Convert decimal to Character

• Email
• Follow

```Hello, friends:

Anybody can help with this issue:

I am going to output around 1000 columns to Excel worksheet, But each Excel spreadsheet has only 256 columns, which are A-Z, AA-AZ, BA- BZ ... etc.  I need to use xlswrite function to write to excel spreadsheet and automatically to change the column to next column.  Is there any way to convert decimal to charcter in ordet to to change the column from A - A AA-AZ ...

Thanks
```
 0
Reply Shirley 1/20/2011 9:35:20 PM

See related articles to this posting

```"Shirley Zheng" wrote in message <iha9qo\$bec\$1@fred.mathworks.com>...
>Is there any way to convert decimal to charcter

char(number)
```
 0
Reply Paulo 1/20/2011 9:59:07 PM

```On 11-01-20 03:35 PM, Shirley Zheng wrote:
> Anybody can help with this issue:
>
> I am going to output around 1000 columns to Excel worksheet, But each Excel
> spreadsheet has only 256 columns, which are A-Z, AA-AZ, BA- BZ ... etc. I need
> to use xlswrite function to write to excel spreadsheet and automatically to
> change the column to next column. Is there any way to convert decimal to
> charcter in ordet to to change the column from A - A AA-AZ ...

The following version is vectorized, supporting a row or column vector of
column numbers in Col, and outputting a cell array of strings, one per column
number to be converted.

strtrim(cellstr(char(repmat(' A',length(Col),1) + [ floor((Col(:)-1)./26)
mod(Col(:)-1,26)] + [33.* (Col(:) > 26) zeros(length(Col),1)])))

The expression can be simplified if you are only working with one Col value at
a time.
```
 0
Reply Think 1/20/2011 10:03:30 PM

```On Jan 21, 10:35=A0am, "Shirley Zheng" <zh...@ucalgary.ca> wrote:
> Hello, friends:
>
> Anybody can help with this issue:
>
> I am going to output around 1000 columns to Excel worksheet, But each Exc=
el spreadsheet has only 256 columns, which are A-Z, AA-AZ, BA- BZ ... etc. =
=A0I need to use xlswrite function to write to excel spreadsheet and automa=
tically to change the column to next column. =A0Is there any way to convert=
decimal to charcter in ordet to to change the column from A - A AA-AZ ...
>
> Thanks

There are many ways to skin a cat...............

I wouldn't do it the way you're planning.
What I'd do is collect all the columns you want to send to Excel into
a matrix and issue a single xlswrite.  Then you wouldn't need to worry
about specifying the columns at all.
```
 0
Reply TideMan 1/20/2011 10:50:47 PM

3 Replies
1139 Views

Similar Articles

12/6/2013 4:40:26 AM
page loaded in 2422 ms. (0)

Similar Artilces:

decimal places
Hi: I am trying to let a customer input the number of decimal points to round to. How can I code this in working storage so I can calc a subscript based on input from the customer. I would like to avoid creating 7 different paragraphs for each option if possible. I have created a sample program to test this below, and I just chose to use a sub of 4. Ref-field turns up with no decimals. Anyone have any suggestions on how I can pull this off. MicroFocus Netexpress 3.1. IDENTIFICATION DIVISION. PROGRAM-ID. testperf. ENVIRONMENT DIVISION.... In article <Xw3nc.9299\$2f6.376381@twister.tampabay.rr.com>, Jerry Huff <jhuff@terrasoftsystems.com> wrote: > Hi: > I am trying to let a customer input the number of decimal points to > round to. > How can I code this in working storage so I can calc a subscript based > on input from the customer. I would like to avoid creating 7 different > paragraphs for each option if possible. I have created a sample program > to test this below, and I just chose to use a sub of 4. Ref-field turns > up with no decimals. Anyone have any suggestions on how I can

converting a line of ascii to decimal
Okay, so I'm trying to read in the file and take each character one at at time and convert them to their numeric equivilants. So far this program just gets me the 1st charachter of each line and changes it. open OUTPUT,">fileout"; open INPUT, "<filein"; while(<INPUT>) { \$val = unpack('c', \$_); print OUTPUT "\$val\n"; \$val2 = pack('U', \$val); print OUTPUT "\$val2\n"; } close INPUT; close OUTPUT; xtrimnx wrote: > Okay, so I'm trying to read in the file and take each character one at > at time and convert them

long(Decimal) performance
Hello c.l.p.ers :) Running long(Decimal) is pretty slow, and the conversion is based on strings. I'm trying to figure out whether there is a good reason for using strings like in decimal.py (that reason would be bound to bite me down the road). This converts Decimal to long and is much faster in my test system (PIII 650MHz, but was written on a P133 a year ago :)). def dec2long(number): """ Convert decimal.Decimal to long. Hopefully faster than C{int(Decimal())}. @param number: A C{decimal.Decimal} value @return: Long from input """ if not isinstance(number, Decimal): raise TypeError, "dec2long requires an instance of Decimal" elif number._is_special: if number._isnan(): raise TypeError, "This Decimal is NaN, an ex-Number" elif number._isinfinity(): raise OverflowError, "Cannot convert infinity to long" else: longstring = str(number) if "e" in longstring: longsplit = longstring.split("e") elif "E" in longstring: longsplit = longstring.split("E"

Converting hexa to decimal
Hello, I have a hexa file which I need to convert to decimal. I use memcpy into variables (char for one octet, short for 2 octets and int for 4 octets) and then print the value into the file by using fprintf. The problem is that I don't know how to convert a field of 6 octets? Should I use a long variable? Thanks Golan wrote: > Hello, > I have a hexa file which I need to convert to decimal. I don't know what that means. > I use memcpy into variables What are you using as the source? > (char for one octet, short for 2 octets > and int for 4 octets) If you... */ memecpy(change,buf[i],sizeof(int)); for(j=0;j<4;j++) printf(change.b[i]); } "Kevin Goodsell" <usenet1.spamfree.fusion@neverbox.com> д����Ϣ���� :w6aLb.25041\$lo3.21765@newsread2.news.pas.earthlink.net... > Golan wrote: > > > Hello, > > I have a hexa file which I need to convert to decimal. > > I don't know what that means. > > > I use memcpy into variables > > What are you using as the source? > > > (char for one octet, short for 2 octets > > and int for 4 octets) > > If you are assuming

number of decimal places
Hi, Is there any way to output a double value with different number of decimal places (apart from using 'sprintf'). I looked up the reference for C++ streams and found the 'setprecision' manipulator, but this sets the number of digits before and after the decimal point. I can't seem to find any manipulator for setting the number of digits after the decimal point. Thanks, -shez- Sorry guys, i've found the answer. Pls ignore. Sorry, -shez- On 19 Jan 2005 19:11:42 -0800, shez <shezanbaig2004@gmail.com> wrote: > Sorry guys, i've found the answer... << std::endl; This should print to two decimal places. Thanks, -shez-

convert decimal -> hexadecimal
Hi folks, The question is easy, hopefully the answer is too :) I have a decimal variable (aka nr = 84), which needs to be converted to a hexadecimal representation of it (aka nr_hex = 54). I found a solution with reads to convert from hexadecimal to decimal but I need it the other way around... Any ideas? Laurens Laurens wrote: > I have a decimal variable (aka nr = 84), which needs to be converted to > a hexadecimal representation of it (aka nr_hex = 54). > I found a solution with reads to convert from hexadecimal to decimal but > I need it the other way around... > > Any ideas? How about the Z format: IDL> nr = 84 IDL> print, nr, format='(Z)' 54 IDL> nr_hex = string(nr, format='(Z)') IDL> help, nr_hex NR_HEX STRING = ' 54' Mike -- www.michaelgalloy.com Michael Galloy wrote: > Laurens wrote: >> I have a decimal variable (aka nr = 84), which needs to be converted >> to a hexadecimal representation of it (aka nr_hex = 54). >> I found a solution with reads to convert from hexadecimal to decimal >> but I need it the other way around... >> >> Any ideas? >

vexing decimal problems
There is problem a veyr simple solution to this, but I am stumped! My table keeps "rounding" up or down decimal numbers to whole numbers. In other words, if I enter a value of "3.75" into a field, it becomes 4.00. I tried fiddling with the properties, setting the numbers of decimals, etc. to no avail. Worse yet, when exporting the data, it retains the rounded figure as the value for the field. Yipes. I am hearing from other people that Access will not accept the value ..5 at all, which I think makes no sense. But I can't get it to accept any decimal at all right... keeps "rounding" up or down decimal numbers to whole numbers. > In other words, if I enter a value of "3.75" into a field, it becomes > 4.00. I tried fiddling with the properties, setting the numbers of > decimals, etc. to no avail. > > Worse yet, when exporting the data, it retains the rounded figure as > the value for the field. Yipes. > > I am hearing from other people that Access will not accept the value > .5 at all, which I think makes no sense. But I can't get it to accept > any decimal at all right now without this idiotic rounding

No output for binary to decimal conversion
Hi all I have posted in this forum before and need some help in the following I have just finished a code that needs to convert binary to decimal. With a little help from here n there i manage to compile without errors but there's one problem though i am not getting any output. If lets say i key in 101 for the binary number n press the button convert nothing comes out. Is it wrong to use the paint method to get the output or am i better off with println(which i tried out but doesn't seem to work) Yr feedback is highly appreciated. [code] import java.awt.*; import java.applet.*; import java.awt.event.*; import java.io.*; /* This is an applet that enables the user to enter the number and the base system of number entered. Upon clicking the Convert button, the program should display the number, the positional weightage of each digit of the number, and the decimal equivalent of the number */ public class Umno extends Applet implements ActionListener { //declare all components Label numbersystemLabel, numberLabel, baseLabel; TextField numberField, baseField; Button convert; static String numberkeyin;//number that is entered in the textfield static String bintype

Decimal and over 100.000 error?
I need embed in which I calculate sum. But problem is with over 100.000 number. It doesn't show value greather than 100.000?!! Why? Don't know. My DATA record is @n13.2, and I have checked all this, it calculate everything correctly step by step, but when value must be greather than 100.000, it shows me 66.078,40 instead of 166.078,40, or it shows me 35.060,00 instead of 235.060,00?! Any help/advice? Thank you. Hi, How is the data defined? It looks like you've got it as a decimal(7,2)? Regards, kurtt Kurt Pawlikowski The Pinrod Corporation... +0200, "I v E k Y" <i v e k y @ email . hinet . hr> wrote: >screen/report control is maybe shorter then needed to display so large text >:-) >make it twice wider then needed That's the point, it isn't :-( On Thu, 10 Jul 2003 07:51:08 -0500, Kurt Pawlikowski <kurtt@pinrod.com> wrote: >Hi, > > How is the data defined? It looks like you've got it as a decimal(7,2)? You have right. Thanks. I definded screen type is 13.2 but characters, decimal was wrong. Ups... and thanks. --------------070304040602060801050600 Content-Type: text/plain

Tolerance decimal placements
Is there anyway to specify decimal placements for the min. and max. variations in a bilateral tolerance separately? For instance, if I want +0.005 to -0, instead of +0.005 to -0.000. On Feb 6, 9:32 am, "cadout" <branch...@yahoo.com> wrote: > Is there anyway to specify decimal placements for the min. and max. > variations in a bilateral tolerance separately? For instance, if I > want +0.005 to -0, instead of +0.005 to -0.000. I guess the question I have is "Why?". Matt On Feb 6, 11:43 am, "fcsuper" <fcsu...@gmail.com> wrote: > On Feb 6, 9:32 am, "cadout" <branch...@yahoo.com> wrote: > > > Is there anyway to specify decimal placements for the min. and max. > > variations in a bilateral tolerance separately? For instance, if I > > want +0.005 to -0, instead of +0.005 to -0.000. > > I guess the question I have is "Why?". > > Matt My bosses want it to look a certain way that's displayed in our catalog (+0.005 to -0). Does 0.000 indicate a level of precision different than 0? That's what they're concerned about. > My bosses want it to look a certain