Looking for multiple string subjects within excel input array

조회 수: 2 (최근 30일)
Saeid
Saeid 2017년 10월 25일
댓글: KL 2017년 10월 25일
I have a table composed of string and numerical entries:
I can read the file using: [NUMM, TEXTT, RAWW]=xlsread('FileName,.xls')
In a large file I want to find all the values related to e.g. "Average Velocity on Highway". Now naturally if I search the exact string it will be easy to find the line number associated with this string and the relevant numerical values on that same line. However, I happen to have many files of more or less the same format but every time there are slight differences in the text part of the array (hyphenation, space, special charcters etc.). It will make it difficult for me to have Matlab read a sequence of files automatically. How I can I perform a search where I can say I need to find the index numbers of a line where the words 'Average' and 'Velcoty' and 'Highway' appear?

답변 (1개)

KL
KL 2017년 10월 25일
편집: KL 2017년 10월 25일
It creates a table just like excel (with variable names as well as row names). It is as simple as,
data_table = readtable('filename.xls','ReadRowNames',true)
  댓글 수: 2
Saeid
Saeid 2017년 10월 25일
OK, thanks, but how can I search this table for a ro containing two strings?
KL
KL 2017년 10월 25일
Try the above command and see how the table looks like, Saeid. Then you can access it easily as shown here: https://de.mathworks.com/help/matlab/matlab_prog/access-data-in-a-table.html

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

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by