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

1 view (last 30 days)
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;

Answers (1)

DGM
DGM on 27 Oct 2021
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'}

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!