Storing values in a variable

1 回表示 (過去 30 日間)
Deepa Maheshvare
Deepa Maheshvare 2019 年 11 月 24 日
コメント済み: KALYAN ACHARJYA 2019 年 11 月 24 日
I want to store values in a variable annd return it to another function
For example,
function A = fun()
A([2 3 4]) = [1 4 7]
end
dA([2 3 4]) = fun()
This doesn't work because A has a zero saved at index 1 and fun returns a 4 x 1array.Is there a way to return A as a 3 x 1 array while saving values only at index 2, 3 and 4 ?
  2 件のコメント
Rik
Rik 2019 年 11 月 24 日
If A has only 3 elements, how can you store something in position 4?
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 11 月 24 日
@Rik :)
Is there a way to return A as a 3 x 1 array while saving values only at index 2, 3 and 4 ?
@Deepa Why? Is there any logic?

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by