Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Char vs String detection #1

Open
YuchenWu2001 opened this issue Oct 30, 2024 · 0 comments
Open

Char vs String detection #1

YuchenWu2001 opened this issue Oct 30, 2024 · 0 comments

Comments

@YuchenWu2001
Copy link

YuchenWu2001 commented Oct 30, 2024

When running lecture13.m, the following error was reported:

>> lecture13
Dot indexing is not supported for variables of this type.

Error in step (line 15)
            xnew = x + dynamics.f(x,u).*dt;

Error in roll_out (line 45)
            xlist(:,k+1) = step(xlist(:,k), ulist(:,k), dt, dynamics, simmode);

Error in lecture13 (line 27)
[tlist, x_fb, u_fb] = roll_out(sys.name, ufb, sys.x0, 'DT', simhorizon, sys.dt, 'Euler');

The reason seems to be the dynamics variable (with content ‘double_intergrator') was detected as a char instead of a string

K>> isa(dynamics, 'string')

ans =

  logical

   0

K>> isa(dynamics, 'char')

ans =

  logical

   1

My temp fix to the problem: replace line 13 of step.m to be:

if isa(dynamics, 'string') | isa(dynamics, 'char')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant