How to pull value of table for char array?
Mostrar comentarios más antiguos
Hi there, I am new to tables (using 2019a) and I can't figure this bit out.
I have char arrays in a table:
t(1,'Domain')
ans =
table
Domain
_____________________
{'www.wisebread.com'}
And I want to make a char array using a value from that table to input as a url in a webwrite();
When I use the code
a = 'www.checkthing.com\thingcheck?domain='+t(1,'Domain')+'&secretkey=secretcode'
I get the error
Undefined operator '+' for input arguments of type 'table'.
alternatively if I use strcat I get the error
Inputs must be character vectors, cell arrays of character vectors, or string arrays.
I think this is supposed to be simple but I can't figure out how to use table values in normal operations :(
Respuesta aceptada
Más respuestas (1)
Mehmed Saad
el 21 de Mayo de 2020
Editada: Mehmed Saad
el 21 de Mayo de 2020
Because t(1,'Domain') is of type table. You need to convert that table output to string or cell. To do that type on Command window
t.Domain(1)
ans =
1×1 cell array
{'www.wisebread.com'}
So basically we extracted the data from table
Now do that strcat step
a = strcat('www.checkthing.com\thingcheck?domain=',t.Domain(1),'&secretkey=secretcode')
1 comentario
Budding MATLAB Jockey
el 21 de Mayo de 2020
Categorías
Más información sobre Tables en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!