[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: String elements
From: |
niles |
Subject: |
Re: String elements |
Date: |
Tue, 04 Apr 95 08:42:22 -0400 |
jwe writes:
>It's not pretty, but you can do this:
>
> s = toascii (s); s = setstr (s (INDEX));
Yeah I hadn't thought of this, actually very useful!
Here's what I did I wrote a tiny function stostr:
function var = stostr(var, loc, string)
var(loc,1:max(size(toascii(string)))) = toascii(string);
Now, in an m-file you can to things like..
states = 0;
k=1;
states = stostr(states,k++,"Beta, Side Silp Angle (Degrees)");
states = stostr(states,k++,"r, Yaw Rate (Degrees/sec)");
states = stostr(states,k++,"p, Roll Rate (Degrees/sec)");
states = stostr(states,k++,"Phi, Roll Angle (Degrees)");
states = stostr(states,k++,"Psi, Yaw Angle (Degrees)");
states = stostr(states,k++,"w, Wind Angle (Degrees)");
--------------------------
then later:
for k = 1:6 % States
ylabel(setstr(states(k,:)))
plot(t,x(:,k))
end
----------------------
thought others might find this useful...
Thanks for the idea!
Rick.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: String elements,
niles <=