I am trying to the row number of '3/8' in a column of text data (52x1) n

1 次查看(过去 30 天)
Tube_data = readtable('Copper Tubes.xls');
Column_1 = Tube_data(1:52,1);
My_Tube_Type = '3/8';
n = 0;
for (i=1:52)
x = Column_1(i,1);
t = strcmp(x,My_Tube_Type);
if t == 1
n = i;
end;
end;

回答(1 个)

DGM
DGM 2021-10-27
Tube_data = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/780803/Copper%20Tubes.xls');
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
Column_1 = Tube_data(1:52,1);
My_Tube_Type = '3/8';
rownum = find(strcmp(table2array(Column_1),My_Tube_Type))
rownum = 3
Column_1(rownum,:)
ans = table
StandardSize ____________ {'3/8'}

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by