StackOverflowMATLABchat/legtools

Add support for R2016b string data type

erikhuizinga opened this issue · 3 comments

MATLAB R2016b supports the string data type. It is somewhat similar to a cell array of strings, but more memory efficient and some functions are specific for strings. Some legtools methods work with a cell array of strings. It seems logical to add support for the new string class.

@erikhuizinga Would you list the methods that can be improved, using a task list (checklist)? It would make it much easier to keep track of the progress of this feature.

Since all methods that use new strings for the future legend use the private strcheck method, only this method needs to be updated with the new functionality if:

The strcheck method...

  • checks for the MATLAB version, and if >= R2016b (v9.1)
    • checks for the string class (isstring) and if true
      • converts the new strings of class string to a cell array of strings (I know, it's a confusing situation MATLAB has created...). This is easily achieved with newString = cellstr(obj_of_class_string)

If this is done, all other methods in the legtools class will support the new string class, because they only ever see a cell array of strings, which is what they already work with. See a024e5f7 (from #7) for an implementation (along with other changes to strcheck).

sco1 commented

See #12