Why doe the data extracted from excel sheet gets converted to scientific power ?

조회 수: 1 (최근 30일)
Sneha Thakur
Sneha Thakur 2019년 4월 19일
댓글: Star Strider 2019년 4월 19일
Hi
I am extracting a huge data from .csv file. I have to plot the time and the power data/radiation data from this file. I first convert the data into arrays and use plot function. The data is fine if I call it in small numbers but if I call the complete data, it gets converted to scientific power form. Hence, the plot is not correct. Following is the code and attached is the csv file and plots.
data = readtable('rundata2.csv');
AccColumn = {'Ppv','tload'}
Ppv = data(:,AccColumn(1));
tload = data(:,AccColumn(2));
Ppv2 = table2array(Ppv);
tload2 = table2array(tload);
plot(tload2,Ppv2)
Solution:
Ppv2(1:100)
ans =
116.5341
110.1099
... so on
But when a larger data is called
1e-16[0.0003
0.0003
0.0003
0.0003
0.0003
0.0003
... soon]
  댓글 수: 2
Sneha Thakur
Sneha Thakur 2019년 4월 19일
Hi Ravi
Plots are not incorrect, But they are in scientific power which I do not want. I want Matlab to extract the original data and plot.
e.g if Ppv = 450, 4000..... it should plot these values and not something like 0.0004*e6, 0.00004 e6....
Thanks
Sneha

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

답변 (1개)

Steven Lord
Steven Lord 2019년 4월 19일
To change the way the data is displayed (which will not impact how it is stored) use the format function.
  댓글 수: 4
Sneha Thakur
Sneha Thakur 2019년 4월 19일
Thanks for your time Strider.
But this does not work either. When I use exponent property, it throws an error:
Code:
format longEng
data = readtable('rundata2.csv');
AccColumn = {'Ppv','tload'}
Ppv = data(:,AccColumn(1));
tload = data(:,AccColumn(2));
Ppv2 = table2array(Ppv);
tload2 = table2array(tload);
plot(tload2,Ppv2)
Ppv2.YAxis.Exponent = 2;
error: Field assignment to a non-structure array
object.
I went through other posts for this error and tried implementing the solutions, But it does not help.
I am searching for other ways to sort out this issue. Thank you for the help.
Please do let me know, if you find something.
Thanks
Sneha Thakur
Star Strider
Star Strider 2019년 4월 19일
The 'Exponent' property is relatively recent, although I do not remember when it was introduced.
You may need to specifically set your 'XTick' and 'XTickLabel' properties to avoid the exponents.

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

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by