필터 지우기
필터 지우기

Error in annotation conversion

조회 수: 1 (최근 30일)
SSG_newbiecoder
SSG_newbiecoder 2018년 4월 22일
댓글: SSG_newbiecoder 2018년 4월 22일
Hello, I'm trying to convert the annotations file I have to numbers and I have written the code below but for AFIB condition, I'm getting an error saying that the matrix dimensions must agree. Can anybody help me? I think it's because I don't know the manipulation of cells.I'm expecting to get an array of numbers instead of the given annotations.
clc; clear all; close all;
[T2,u2,v2] = xlsread('E:\data_Lab\MITBIH\annots\ALL_sEGS\all the annots\ONLY THE 5\INI_FIVE.xlsx');
for i=1:length(u2)
if u2{i}=='N'
num_annot(i)=1;
elseif u2{i}=='AFIB'
num_annot(i)=7;
elseif u2{i}=='SVTA'
num_annot(i)=6;
elseif u2{i}=='BII'
num_annot(i)=8;
elseif u2{i}=='A'
num_annot(i)=2;
elseif u2{i}=='V'
num_annot(i)=3;
elseif u2{i}=='L'
num_annot(i)=4;
elseif u2{i}=='R'
num_annot(i)=5;
elseif u2{i}=='F'
num_annot(i)=9;
else num_annot(i)=0;
end
end

채택된 답변

Walter Roberson
Walter Roberson 2018년 4월 22일
You should not use == to compare character vectors. You should use strcmp instead.
  댓글 수: 1
SSG_newbiecoder
SSG_newbiecoder 2018년 4월 22일
Yes now the code is running without any error. Also I had to convert it using string. Thank you so much.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by