reading strings and apying functions

1 回表示 (過去 30 日間)
KA
KA 2015 年 11 月 11 日
コメント済み: KA 2015 年 11 月 18 日
I am a novice at MATLAB and want to write a script that will involve several steps as follows:
1) Define two different vectors (can call them v-left, v-right) where a number is assigned to different letters of the alphabet. Say 1 – 26 for v-left and 27 – 52 for v-right.
2) Then write a string such as =’zxcvbnm’.
3) Have the script read the string at two positions starting at (1,3) i.e. (z,c).
4) Find the value for each letter as defined by v-left and v-right with the 1st letter in the pair (z) assigned to (v-left) and the 2nd letter in the pair (c) assigned to (v-right).
5) Apply a function to each value (e.g. log) and then average the two values.
6) Loop around and repeat the process but with each position in the string both increased by +1.
7) Repeat steps 3 -6 until the loop reaches the positions (length -2,length i.e. (b,m) in this instance)
8) Find the sum of all the values for each loop and display it.
Advice is very welcome. I may have to break this down a bit and ask in chunks.
  3 件のコメント
Stephen23
Stephen23 2015 年 11 月 16 日
編集済み: Stephen23 2015 年 11 月 16 日
You will learn best when you actually try something. Don't be afraid of making mistakes: start MATLAB and experiment. Use your favorite internet search engine to locate the appropriate documentation or advice on how to code each of those steps. The more you attempt and the more that you try the more you will learn.
To get started you should work through these tutorials:
And read this:
KA
KA 2015 年 11 月 18 日
Hi thank you both. I am trying a different approach now, think this approach was flawed from the outset.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by