필터 지우기
필터 지우기

converting table data and substitute values in table

조회 수: 3 (최근 30일)
Maritza Torres
Maritza Torres 2019년 12월 10일
답변: Maadhav Akula 2019년 12월 13일
I need help converting my table data 'D1DIRECTION' . I want to add 360 to any value over 270 so when I have to subtract (270 - data) I will have positive values. I want to replace this new data with the old one.

답변 (1개)

Maadhav Akula
Maadhav Akula 2019년 12월 13일
As per my understanding of your question, you want to add 360 to any value in D1D1DIRECTION, which is more than 270, for that you can do the following:
log = D1DIRECTION > 270; %Logical vector which gives 1 for values more than 270
ind = find(log); %Finding the indices where D1DIRECTION is more than 270
D1DIRECTION(ind) = D1DIRECTION(ind) + 360; %Adding 360 for values which are more than 270
Hope this helps!

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by