![]() ![]() From what I've understood of your example, something like: > compare = coder. You can use the function coder.typeof to specify variable-size inputs to codegen. The string compare can also have different lengths depending on the function call. I know I'm supposed to specify the types of the inputs when using codegen, but I'm not sure how to do this for a cell array of strings, the elements of which can be of different length. Use -args or preconditioning statements to specifyĬode generation failed: View Error Report Type of input argument 'compare' for function 'list_iterator' MATLAB® also provides functions to inspect characters in pieces of text. You can sort string arrays using the sort function, just as you would sort arrays of any other type. You can compare string arrays and character vectors with relational operators and with the strcmp function. When I run codegen list_iterator in the Command Window, I get the following error: Compare text in character arrays and string arrays in different ways. (I'm doing this to speed up execution because N can be quite large - around 10 to 20 million elements.) The basic command is: > strcmp (string1, string2) If string1 and string2 are the same, then matlab will return the value 1. The code basically compares each element of list to compare and returns 1 if the two are the same and 0 otherwise. To compare strings in matlab, we use the 'strcmp' command or read 'string compare'. List is an N x 1 cell array of strings and compare is a string. I am trying to use the MATLAB Coder toolbox to convert the following code into C: function = list_iterator(compare, list)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |