Info
This question is closed. Reopen it to edit or answer.
how to properly textscan
1 view (last 30 days)
Show older comments
Can someone please fully explain textscan function as i am new to matlab and am unsure what some of the code already on this forum means?
I am trying to make a search tool that relates a user input to a row in an imported table.
I want the user to type an input and using that input, the script relates it to a previous matrix to display that row's information.
eg; if my table is:
age initials gender
25 am F
32 dp m
and I type as my input "am"
I want to text scan in my table for "am" and display: 25 / F for exapmle??
1 Comment
Michal
on 25 Nov 2019
If you have the table already imported you do not need to use textscan. Provided that the user always inputs initials you can find the corresponding info like this:
ind = find(strcmp(t.initials,user_input)); % locate the initials that the user wants; t is the table
if ~isempty(ind) % checking whether the initials were found at all
t(ind,:) % show the row that contains the initials
end
You would typically use textscan to scan through files or chunks of text.
Answers (0)
This question is closed.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!