フィルターのクリア

update all array of the value

4 ビュー (過去 30 日間)
vaya putra
vaya putra 2022 年 6 月 18 日
回答済み: Image Analyst 2022 年 6 月 18 日
i have array 10000x1
my plan is to upadate all value into new value
a=old; %10000x1
b=new; % 10000x1
by using a=b;
i got problem for next calculation looks the new value duplicate many time then i got divergence calculation
i tried changed some value
example;
b(10)=10e-9;
b(11)=10e-9;
b(12)=10e-9;
b(13)=10e-9;
the calculation worked properly and the calculation did not multiple the new value
but i must update all value any idea
  4 件のコメント
Voss
Voss 2022 年 6 月 18 日
@vaya putra: Not that this necessarily addresses your question, but note that 10e-9 means 10*10^-9, which is 10^-8 (i.e., 1e-8):
10e-9
ans = 1.0000e-08
vaya putra
vaya putra 2022 年 6 月 18 日
編集済み: vaya putra 2022 年 6 月 18 日
i tried to changed in the particulary address i got the same problem in my calculation
a(3000) = b(3000)
...
...
a(8000) = b(8000)
but when change one by one with real number
a(3000)=9e-14;
a(3001)=9e-14;
....,...a(8000)=9e-14;
it worked
i dont know what the problem with my calculation

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

採用された回答

Image Analyst
Image Analyst 2022 年 6 月 18 日
When you do
a=old; %10000x1
b=new; % 10000x1
a=b;
a will now have the values of b and new. Then you said the problem is when you try to change a few specific values by doing:
b(10)=10e-9;
b(11)=10e-9;
b(12)=10e-9;
b(13)=10e-9;
Now this will change elements 10-13 of b but will NOT change those elements in new or a. Just because you did a=b does not mean that a is a pointer into the b locations of memory and that changing b should automatically change a simultaneously. If you want a to change you'll have to assign those elements of a explicitly.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by