how do i get rid of the e notation in a variable? eg 4.321e+003, i just need it as 4321. its stopping me from plotting a graph.

 채택된 답변

Walter Roberson
Walter Roberson 2011년 7월 12일

0 개 추천

Sounds to me as if you have accidentally created a variable named "plot".
In the mean time, use round() on your data and see if you get a plot out. My guess is that you will not.

댓글 수: 7

Paulo Silva
Paulo Silva 2011년 7월 12일
Walter that's a good assumption, let's see if it's correct or not, I'm very curious about it.
Naveen Francis
Naveen Francis 2011년 7월 12일
no i havent created a variable called plot. atleast its not shown in the workspace. and your guess is right, round doesnt work.
Walter Roberson
Walter Roberson 2011년 7월 12일
Okay, we need to see your code, and we need to see the traceback of the error. Please also show us
which -all plot
Naveen Francis
Naveen Francis 2011년 7월 12일
here's the code -
h=wavread('song1.wav');
>> plot(h)
>> plot(h)
>> [sums,peak,onset] = SF3('song1.wav');
Elapsed time is 0.351198 seconds.
>> z=onset*44100;
>> hold on
>> plot(z,a(z),'*r');
??? Subscript indices must either be real positive integers or logicals.
Naveen Francis
Naveen Francis 2011년 7월 12일
however, it seems to work when i tried another example -
d=[12143 34234 234252 656 5757575 34 344423 2 98989809 23578032 28272293 2626384738 33983 399839 988 6364536546 8787 3434 535838 998798 2323 2387873 6767757 23565 76767 9898 232323 98989 34343 767676];
>> r=1:30;
>> plot(r,d(r))
works fine here (scratching head)...
ne clues??
Walter Roberson
Walter Roberson 2011년 7월 12일
What is "a" ? If it is an array, then a(z) would be attempting to subscript "a" by the values in "z".
If "a" is an array and you are expecting that "z" will work out as integral, then you might be experiencing floating point roundoff limitations; if so then a(round(z)) should work (unless some z rounds to zero.)
Naveen Francis
Naveen Francis 2011년 7월 12일
got it.:)

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Friedrich
Friedrich 2011년 7월 12일

0 개 추천

Hi,
have a look at the format function:
So this should work
format long

댓글 수: 1

Naveen Francis
Naveen Francis 2011년 7월 12일
i tried that but it doesnt seem to work!

댓글을 달려면 로그인하십시오.

Paulo Silva
Paulo Silva 2011년 7월 12일

0 개 추천

No it's not stopping you unless the variable is a string instead of a number, please provide more details.

댓글 수: 3

Naveen Francis
Naveen Francis 2011년 7월 12일
unfortunately, it is stopping me. the array is in 'double' format. the plotting works correctly only if i change the e notation manually. here's the message i get while plotting -
"??? Subscript indices must either be real positive integers or logicals."
Naveen Francis
Naveen Francis 2011년 7월 12일
i guess the 'e' in the number must be interpreted as a character by matlab which is why its giving me an error while plotting.
Paulo Silva
Paulo Silva 2011년 7월 12일
something doesn't seem right, please provide the code and a sample of the data

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by