Command to get specific row and column data to be displayed in the code

I wish to get the value of Voltage(First column) where my current(Second) changes its sign from negative to positive(or Vice versa there is not much difference in the two adjacent values). Can anyone suggest which command should i use to extract the voltage from the given spreadsheet and display it in my script?

1 件のコメント

madhan ravi
madhan ravi 2019 年 2 月 14 日
Try specifying the range as 'A1731:B1732'

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2019 年 2 月 14 日
編集済み: KSSV 2019 年 2 月 14 日
% Make dummy data
A = [rand(10,1) rand(10,1)] ;
s = ones(10,1) ;
s(1:5) = -1;
A(:,2) = s.*A(:,2) ;
% get index of sign change
s = sign(A(:,2)) ;
idx = find(diff(s)~=0) ;
iwant = A(idx:idx+1,:)

質問済み:

2019 年 2 月 14 日

編集済み:

2019 年 2 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by