how to read ECG data in similink ?
조회 수: 8 (최근 30일)
이전 댓글 표시
i have this code in MAtlab load ('sel100m.mat') % the signal will be loaded to "val" matrix val = (val - 1024)/200; % you have to remove "base" and "gain" ecg = val(1,1:1000); % select the lead (Lead I) fs = 360; % sampling frequecy t = (0:length(ecg)-1)/fs; % time plot (t, ecg); and when i try to similiate with block from workspace i have this message Invalid matrix-format variable specified as workspace input in 'untitled/From Workspace'. The matrix must have two dimensions and at least two columns. Complex signals of any data type and non-double real signals must be in structure format. The first column must contain time values and the remaining columns the data values. Matrix values cannot be Inf or NaN. can you help me, thank you.
댓글 수: 0
답변 (1개)
Himanshu
2024년 10월 28일 5:53
Hey Alice,
The error message you're encountering indicates that the input data for the "From Workspace" block in Simulink needs to be formatted such that it is a matrix where the first column contains time values and the subsequent columns contain the corresponding data values.
You already have the required data, all you need is to transpose 't' and 'ecg' and combine them into a single matrix.
% Combine time and data into a single matrix
simulink_input = [t' ecg']; % transpose to ensure columns
Now, you can use 'simulink_input' as the input for the "From Workspace" block in Simulink.
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 ECG / EKG에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!