getting string from cell using if statement

조회 수: 13 (최근 30일)
Robert Zabel
Robert Zabel 2018년 4월 16일
답변: Star Strider 2018년 4월 16일
[~,~,raw] = xlsread('StudentData_20students.xlsx');
header = raw(1,:);
data = raw(2:end,:);
x = data(:,3)
for q = 1:20
n = x(q,1)
if n == 'ON'
b = 'TRUE'
end
end

답변 (1개)

Star Strider
Star Strider 2018년 4월 16일
The best way to compare strings is to use the strcmp (link) or related functions (linked to at the end of that page).

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by