I'm trying to import a .txt-table as a "struct with fields". For that, I use readtable() and table2struct. But MATLAB creates a struct array with the two columns Var1 and Var2. I don't want it like that but rather like in the last screenshot, which I took from a previous work of someone else. Here, the column "Field" contains the labels of the variables and column "Value" contains the corresponding values.
The difference is that the struct I create is a struct array, whereas the one from my template is just a "struct with fields".
Side note: Another problem is that the Value "test@google.com" is a NaN when I import it. Any idea how to correctly import the string?
Matlab2020b.
Best Answer