Concatenating values to form a matrix

조회 수: 3 (최근 30일)
Fil Okua
Fil Okua 2021년 4월 25일
댓글: Mathieu NOE 2021년 4월 26일
I am trying to loop through a table filed to return values greater than 10.
I am only getting ones in the resulting matrix.
I intend to get the values instead. Please my code below:
Year = [];
for i = 1:size(D, 1)
if (any(D(i, 2:13) > 10))
rows = [Year, i];
Year = [D(Year), D(i)];
Value = [D(rows,2:13)];
TableValue10 = [Year & Value]
end
end
  댓글 수: 1
Mathieu NOE
Mathieu NOE 2021년 4월 26일
hello
the & implies you are doing a logical comparison between Year and Value
I guess you wanted something else like : TableValue10 = [Year Value] or TableValue10 = [Year ; Value]

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

답변 (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