Hi there I am trying to help my brother in matlab and answer this question for him I know a question of this length is a bit long but could someone help me with this code, I promised to help him out Thank you

4 件のコメント

Stephen23
Stephen23 2017 年 9 月 16 日
編集済み: Stephen23 2017 年 9 月 16 日
@sam jones: it is great that you have some homework, but you forgot to actually ask us a question. What is your question for us?
Star Strider
Star Strider 2017 年 9 月 16 日
Note: OP removed the image (scanned page) that actually explains the problem to be solved.
sam jones
sam jones 2017 年 9 月 16 日
sorry what do you mean
Star Strider
Star Strider 2017 年 9 月 16 日
You (or someone else) removed the image that explains the problem.

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

 採用された回答

Andrei Bobrov
Andrei Bobrov 2017 年 9 月 16 日

0 投票

To start plese use function sub2ind

5 件のコメント

Andrei Bobrov
Andrei Bobrov 2017 年 9 月 16 日
Please read about sub2ind
Andrei Bobrov
Andrei Bobrov 2017 年 9 月 16 日
編集済み: Andrei Bobrov 2017 年 9 月 16 日
hm.
Please see on this:
ii = [3 4 3 2 1 2];
jj = [1 2 3 4 5 6];
elev = E(sub2ind([m,n],ii,jj))
Jan
Jan 2017 年 9 月 16 日
編集済み: Jan 2017 年 9 月 16 日
@sam jones: Programming should not be a question of luck. Try it and if it does not work as expected, post the following details:
  1. The current code
  2. Explanation of what the code does (perhaps a complete error message)
  3. Explanation of what you expect it to do instead
Ask specific questions to get help in this forum. The statement "no luck :(" does not allow for an assistance, such that it only wastes your time. See https://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
Andrei Bobrov
Andrei Bobrov 2017 年 9 月 16 日
編集済み: Andrei Bobrov 2017 年 9 月 16 日
function [ELEVATION] = FindPathElevationsAndCost (ii,jj,E)
[m,n] = size(E);
ELEVATION = E(sub2ind([m,n],ii,jj));
sam jones
sam jones 2017 年 9 月 16 日
Thanks!! I understand now

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeTime Series Events についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by