I am trying to store the string in to one array in if else state ment. i get this error
Subscripted assignment dimension mismatch.
Error in connect (line 68) blob(i)='rectangle';
Best Answer
This error means that you are trying to assign to an element of vectorblob (size 1x1) a vector a size 1x9. That happens because in MATLAB, a string is a vector of characters:'rectangle' is a vector of size 1x9, butblob(i) has size 1x1.
Are you trying to store strings of various sizes in the variableblob? What do you want to do when storing strings in a vector?
strcat() has the property that it trims out leading and trailing blanks from parameters that are character vectors. It does not do that for cell array of character vectors.
Cell arrays can store mixed data types and of varying sizes. For example, a cell array can contain an n-by-m matrix as its first element and a scalar as its second element, or it can contain strings of varying length.
Cell arrays work very similarly to regular arrays. The small difference in the syntax is the use of curly braces{ and} (see code above).
Best Answer