Extract specific line with nubers

조회 수: 1 (최근 30일)
Yerkebulan Ali
Yerkebulan Ali 2019년 4월 20일
편집: Andreas Bernatzky 2019년 4월 20일
How can I extract specific line with numbers? There is a long data. For example I need pull up this line 1.000E+36 5.000 47.250 0.500 1.32581E-15 7.76995E-01 , but second number which is R=5, but instead of 5 i need like 10, 15, 20 variables changing.
Energy R Z Th Result Rel Error
1.000E+36 5.000 6.750 0.500 2.14157E-17 9.41189E-01
1.000E+36 5.000 20.250 0.500 3.03054E-16 4.40884E-01
1.000E+36 5.000 33.750 0.500 8.99403E-16 6.43572E-01
1.000E+36 5.000 47.250 0.500 1.32581E-15 7.76995E-01
1.000E+36 5.000 60.750 0.500 2.98685E-15 4.44014E-01
1.000E+36 5.000 74.250 0.500 4.74431E-15 4.53362E-01
1.000E+36 5.000 87.750 0.500 6.20340E-15 5.40478E-01
1.000E+36 5.000 101.250 0.500 2.08979E-15 5.63431E-01
1.000E+36 5.000 114.750 0.500 1.72973E-15 5.51851E-01

채택된 답변

Andreas Bernatzky
Andreas Bernatzky 2019년 4월 20일
편집: Andreas Bernatzky 2019년 4월 20일
Hey Ali,
I hardly recommend you to format your data as a table.
For extracting a specific Line use find():
For Example:
Energy R Z Th Result Rel Error
1.000E+36 5.000 6.750 0.500 2.14157E-17 9.41189E-01
Energy=1;
R=1;
Z=1;
Th=1;
Result=2;
RelError=3;
%myTable is your readIn Data
YourLine=find(myTable{:,1}==Energy&myTable{:,2}==R&myTable{:,3}==Z&myTable{:,4}==Th,&myTable{:,5}==Result&...
myTable{:,6}==RelError);
if(isempty(YourLine)==0)%just to prevent crashes if a line can not be found
%do something further
end

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by