Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

how to properly textscan

1 visualización (últimos 30 días)
Matthew Perry
Matthew Perry el 25 de Nov. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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 comentario
Michal
Michal el 25 de Nov. de 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.

Respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by