MATLAB Answers

loop through array of strings in tic

3 views (last 30 days)
Caroline Brandberg
Caroline Brandberg on 9 Jun 2017
Hi,
I want to loop through an array of strings in tlc that I retrieve from a MATLAB function.
I.e., something like the following: (OBS, this code doesn't work)
%assign values = FEVAL("my_fcn", arg)
%assign nbrOfValues = FEVAL("length", values)
%foreach i = nbrOfValues
%<values[i]>
%endforeach
How do I do this?

  4 Comments

Show 1 older comment
Rik
Rik on 9 Jun 2017
It look like you would benefit from a crash course on Matlab. Your example code is not Matlab syntax, but it is very close to is, so why write it this way?
And whatever you do, try to find a way to solve your problem without having to resort to feval, eval or global variables. It is virtually always possible and virtually always a far superior piece of code.
Philip Borghesani
Philip Borghesani on 9 Jun 2017
This is not MATLAB code it is tlc for the Target Language Compiler to create an S-function for use with Simulink and RTW.
Caroline Brandberg
Caroline Brandberg on 3 Jul 2017
Yes, sorry for the confusion, and thanks @Philip Borghesani for the clarification. Any ideas of how to solve this issue?

Sign in to comment.

Answers (0)

Sign in to answer this question.