MATLAB: How to get the script to accept a user input in the form of a vector

inputscriptvector

I want users to be able to input a series of letters and then display the numerical values I have pre-assigned each letter. Specifially, the input would be an amino acid sequence. Each amino acid is pre-assigned values based on their chemical properties. I need to be able to display and sum these values from any given sequence.
As I'm new to matlab, any help will be greatly appreciated!

Best Answer

Using inputdlg:
prompt = {'Enter aminno acid sequence: '};
dlg_title = 'Create A Protein!';
num_lines = 1;
win_len = [1 50];
Caaseq = inputdlg(prompt, dlg_title, win_len);
Saaseq = Caaseq{:};
MW = randi([20 60], 1, 23);
AA = 'A':'W';
for k1 = 1:length(Saaseq)
aa(k1) = Saaseq(k1);
val(k1) = MW(strfind(AA,aa(k1)));
end
The ‘aa’ array are the individual letters in the input sequence, ‘val’ are the associated values.