フィルターのクリア

Subtracting two matrices yields a scalar in MATLAB

1 回表示 (過去 30 日間)
Nourhan
Nourhan 2014 年 3 月 2 日
編集済み: Paul 2014 年 3 月 2 日
Dear all,
I have the following code :
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:length(QRS_onset)
T_wave_duration_in_sec(i)=ST_Interval_in_sec(i)-ST_Segment_in_sec(i);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Both the ST interval and ST segment are matrices. However, the result of T wave duration is scalar. Why is this?
Thanks in advance for the help

採用された回答

Paul
Paul 2014 年 3 月 2 日
編集済み: Paul 2014 年 3 月 2 日
Are you trying to only substract some of the elements? Else you can simply do: A-B. Also i guess you mean the result is a vector instead of a matrix. That is because of the way you fill it. You use linear indices for ST_Interval_in_sec and since T_wave_duration_in_sec is not predefined it just makes a vector. See: http://www.mathworks.nl/company/newsletters/articles/matrix-indexing-in-matlab.html
You can fix this by doing this before the loop: T_wave_duration_in_sec = zeros(rows,cols);
rows and cols should be the size of the output matrix.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by