How can I make a string follow a graph in a Matlab Gui.

For this lab, we are required to input a string, into an edit text box in a matlab gui. This string will then follow the curve of our graph that has been plotted. Each individual letter will be followed the by next letter. So, for example, if I was to input hello into the edit text box, the H would be followed by the E and then the L and so on and so forth.
here is a link to the Lab. I have already done the first part of it.
I would greatly appreciate any help with this lab. I am having trouble with splitting up the word. I am also struggling to make the letters follow the curve I have plotted.

2 Comments

Show us your code for making the letters follow the curve, and describe more specifically what you see when you use your code and how that differs from what you should have.
Note: I am not going to bother following along with a flash video of a lab to see what you need to do.
Here is the code:
function func_1_Callback(hObject, eventdata, handles)
% Get the values the user inputed from other functions.
min = str2num(get(handles.t_min,'String'));
max = str2num(get(handles.t_max,'String'));
% Now the samples/sec will be included in the GUI.
frate = str2num(get(handles.framerate,'String'));
% The value of a will be incorporated in the indent for the x values.
% This is the samples/sec.
a = (max-min)/frate;
t = min:a:max;
y = eval(get(handles.func_1,'String'));
plot(t,y);
for i = min:0.1:max
pause(0.5);
text(t,y,'hello');
end
This is the code for one of the callbacks in the gui m.file. When I use this code, I cant even see the letters on the plot and I am not able to split any words up. What I am supposed to have is an input edit text box. What ever word I enter into the box, the gui will have the word follow the plot of the graph that is displayed on the axes.
So if I use the word hello, H will be followed by E and L and then L and so on, whilst moving along the plot of the graph and rotating according to the plot. So for a sin curve, the letters would rotate between 0 and 90 degrees.
Would it be possible for me to copy the contents of the edit text box, into an array and then plot each letters using a for loop?

Sign in to comment.

Answers (1)

If you entered the string 'hello' and store that in the variable S, then the first letter is S(1), the second letter is S(2) and so on.

Categories

Asked:

on 6 Feb 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!