I have a struct array in which one of the fields is a character array. I need to convert it to a string scalar for all stuctures in the array. I have been unable to find a way to do this in a vectorized manner.
myArray = [struct("code", 'CO128'), struct("code", 'TX457'];
This is a toy data structure -- the real thing has dozens of fields in each element and tens of thousands of elements in the array. I have no control over the array format up to this point.
What I am trying to accomplish is the same thing that is performed by the following loop:
for i = 1:size(myArray,2)
myArray(i).code = string(myArray(i).code);
I am restricted to the functionality of the basic MATLAB R2021a installation (no optional toolboxes).