Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

how to properly textscan

1 vue (au cours des 30 derniers jours)
Matthew Perry
Matthew Perry le 25 Nov 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
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 commentaire
Michal
Michal le 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.

Réponses (0)

Cette question est clôturée.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by