Thread Subject: Issue with double data type

Subject: Issue with double data type

From: Zulkifli

Date: 30 Oct, 2009 09:15:19

Message: 1 of 8

Dear all,

I have question here. I have 1 row data data with 100 columns in an array (1x8192).
The data type is double. The data consists of variable data from -1.5 to 1.86. The question here is that, i want to multiply this array by 1000, so as a result, the data will be varies from -1500 to 1860. But, when i type the command, it would allow me. it did not come up with error but, the result is not like what i'm expected. The result still as previous data. seems like i did not multiply it. Didi do something wrong? thanks

Subject: Issue with double data type

From: nor ki

Date: 30 Oct, 2009 09:24:07

Message: 2 of 8

"Zulkifli " <zulkifliaziz@yahoo.com> wrote in message <hcear7$fvk$1@fred.mathworks.com>...
> Dear all,
>
> I have question here. I have 1 row data data with 100 columns in an array (1x8192).
> The data type is double. The data consists of variable data from -1.5 to 1.86. The question here is that, i want to multiply this array by 1000, so as a result, the data will be varies from -1500 to 1860. But, when i type the command, it would allow me. it did not come up with error but, the result is not like what i'm expected. The result still as previous data. seems like i did not multiply it. Didi do something wrong? thanks

could you post your code?

Subject: Issue with double data type

From: Zulkifli

Date: 30 Oct, 2009 09:36:01

Message: 3 of 8

"nor ki" <kinor.removeme@gmx.de> wrote in message <hcebbn$ljb$1@fred.mathworks.com>...
> "Zulkifli " <zulkifliaziz@yahoo.com> wrote in message <hcear7$fvk$1@fred.mathworks.com>...
> > Dear all,
> >
> > I have question here. I have 1 row data data with 100 columns in an array (1x8192).
> > The data type is double. The data consists of variable data from -1.5 to 1.86. The question here is that, i want to multiply this array by 1000, so as a result, the data will be varies from -1500 to 1860. But, when i type the command, it would allow me. it did not come up with error but, the result is not like what i'm expected. The result still as previous data. seems like i did not multiply it. Didi do something wrong? thanks
>
> could you post your code?
num=textread('file.txt');
num=num';
num1=imresize(num,[1 100]);
num1=num1*1000; --> here where the problem occured

Thanks

Subject: Issue with double data type

From: Sebastiaan

Date: 30 Oct, 2009 09:45:05

Message: 4 of 8

> > could you post your code?
> num=textread('file.txt');
> num=num';
> num1=imresize(num,[1 100]);
> num1=num1*1000; --> here where the problem occured
>
> Thanks
Are you sure your output is not something like:
>> num1
num1 =
           1.1234 2.2000 3.3000
>> num1 = num1*1000
num1 =
        1.0e+03 *
           1.1234 2.2000 3.3000

As in, each element has to be multiplied with 1.0e03 (1000) ?

Sebastiaan

Subject: Issue with double data type

From: Zulkifli

Date: 30 Oct, 2009 11:07:02

Message: 5 of 8

"Sebastiaan " <s.breedveld@erasmusmc.REMOVE.BOO.BOO.nl> wrote in message <hcecj1$geq$1@fred.mathworks.com>...
> > > could you post your code?
> > num=textread('file.txt');
> > num=num';
> > num1=imresize(num,[1 100]);
> > num1=num1*1000; --> here where the problem occured
> >
> > Thanks
> Are you sure your output is not something like:
> >> num1
> num1 =
> 1.1234 2.2000 3.3000
> >> num1 = num1*1000
> num1 =
> 1.0e+03 *
> 1.1234 2.2000 3.3000
>
> As in, each element has to be multiplied with 1.0e03 (1000) ?
>
> Sebastiaan

Thanks Sebastian,
You right. the output as you describe. But how i can implement so that the output become when
num1=num1*1000
the output become as
1123.4 2200.0 3300.0

Really need help.... thanks

Subject: Issue with double data type

From: Pekka Kumpulainen

Date: 30 Oct, 2009 11:50:04

Message: 6 of 8

"Zulkifli " <zulkifliaziz@yahoo.com> wrote in message <hcehcm$es7$1@fred.mathworks.com>...
> "Sebastiaan " <s.breedveld@erasmusmc.REMOVE.BOO.BOO.nl> wrote in message <hcecj1$geq$1@fred.mathworks.com>...
> > > > could you post your code?
> > > num=textread('file.txt');
> > > num=num';
> > > num1=imresize(num,[1 100]);
> > > num1=num1*1000; --> here where the problem occured
> > >
> > > Thanks
> > Are you sure your output is not something like:
> > >> num1
> > num1 =
> > 1.1234 2.2000 3.3000
> > >> num1 = num1*1000
> > num1 =
> > 1.0e+03 *
> > 1.1234 2.2000 3.3000
> >
> > As in, each element has to be multiplied with 1.0e03 (1000) ?
> >
> > Sebastiaan
>
> Thanks Sebastian,
> You right. the output as you describe. But how i can implement so that the output become when
> num1=num1*1000
> the output become as
> 1123.4 2200.0 3300.0
>
> Really need help.... thanks

So the results are correct. But you don't like the way they are displayed in the command window?
doc format, try
>> format bank

Subject: Issue with double data type

From: Zulkifli

Date: 30 Oct, 2009 12:15:22

Message: 7 of 8

"Pekka Kumpulainen" <pekka.nospam.kumpulainen@tut.please.fi> wrote in message <hcejtc$j16$1@fred.mathworks.com>...
> "Zulkifli " <zulkifliaziz@yahoo.com> wrote in message <hcehcm$es7$1@fred.mathworks.com>...
> > "Sebastiaan " <s.breedveld@erasmusmc.REMOVE.BOO.BOO.nl> wrote in message <hcecj1$geq$1@fred.mathworks.com>...
> > > > > could you post your code?
> > > > num=textread('file.txt');
> > > > num=num';
> > > > num1=imresize(num,[1 100]);
> > > > num1=num1*1000; --> here where the problem occured
> > > >
> > > > Thanks
> > > Are you sure your output is not something like:
> > > >> num1
> > > num1 =
> > > 1.1234 2.2000 3.3000
> > > >> num1 = num1*1000
> > > num1 =
> > > 1.0e+03 *
> > > 1.1234 2.2000 3.3000
> > >
> > > As in, each element has to be multiplied with 1.0e03 (1000) ?
> > >
> > > Sebastiaan
> >
> > Thanks Sebastian,
> > You right. the output as you describe. But how i can implement so that the output become when
> > num1=num1*1000
> > the output become as
> > 1123.4 2200.0 3300.0
> >
> > Really need help.... thanks
>
> So the results are correct. But you don't like the way they are displayed in the command window?
> doc format, try
> >> format bank

The output is not as i wanted. I wanted the output display as 1123.4 not 1.1234
Thanks

Subject: Issue with double data type

From: Sebastiaan

Date: 30 Oct, 2009 13:28:01

Message: 8 of 8

"Zulkifli " <zulkifliaziz@yahoo.com> wrote in message <hcelcq$ko4$1@fred.mathworks.com>...
> "Pekka Kumpulainen" <pekka.nospam.kumpulainen@tut.please.fi> wrote in message <hcejtc$j16$1@fred.mathworks.com>...
> > "Zulkifli " <zulkifliaziz@yahoo.com> wrote in message <hcehcm$es7$1@fred.mathworks.com>...
> > > "Sebastiaan " <s.breedveld@erasmusmc.REMOVE.BOO.BOO.nl> wrote in message <hcecj1$geq$1@fred.mathworks.com>...
> > > > > > could you post your code?
> > > > > num=textread('file.txt');
> > > > > num=num';
> > > > > num1=imresize(num,[1 100]);
> > > > > num1=num1*1000; --> here where the problem occured
> > > > >
> > > > > Thanks
> > > > Are you sure your output is not something like:
> > > > >> num1
> > > > num1 =
> > > > 1.1234 2.2000 3.3000
> > > > >> num1 = num1*1000
> > > > num1 =
> > > > 1.0e+03 *
> > > > 1.1234 2.2000 3.3000
> > > >
> > > > As in, each element has to be multiplied with 1.0e03 (1000) ?
> > > >
> > > > Sebastiaan
> > >
> > > Thanks Sebastian,
> > > You right. the output as you describe. But how i can implement so that the output become when
> > > num1=num1*1000
> > > the output become as
> > > 1123.4 2200.0 3300.0
> > >
> > > Really need help.... thanks
> >
> > So the results are correct. But you don't like the way they are displayed in the command window?
> > doc format, try
> > >> format bank
>
> The output is not as i wanted. I wanted the output display as 1123.4 not 1.1234
> Thanks
Then you have to write your own formatting, e.g.:

fprintf('%5.4f ', num1); fprintf('\n');

doc fprintf

Sebastiaan

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
array Zulkifli 30 Oct, 2009 05:19:05
multiply Zulkifli 30 Oct, 2009 05:19:05
rssFeed for this Thread

Contact us at files@mathworks.com