How can I create a new variable after replacing some data from old variable?

% firstly,I have
A = [1 2 3 4 5; 6 7 8 9 10]
% then replace some value
A(A>3)=-999
%I would like to have
B= [1 2 3 -999 -999; -999 -999 -999 -999 -999] in the workspace.
%How to create independent B from edited A?
%Please advise

 採用された回答

madhan ravi
madhan ravi 2018 年 10 月 27 日
A = [1 2 3 4 5; 6 7 8 9 10]
B=A
B(A>3)=-999

4 件のコメント

madhan ravi
madhan ravi 2018 年 10 月 27 日
By copying the matrix you could do it
Kittipon Wutthimetheekul
Kittipon Wutthimetheekul 2018 年 10 月 27 日
I got it!! thank you so much
madhan ravi
madhan ravi 2018 年 10 月 27 日
編集済み: madhan ravi 2018 年 10 月 27 日
Anytime :), if it worked out make sure to accept the answer so that other people know that the question is solved
Kittipon Wutthimetheekul
Kittipon Wutthimetheekul 2018 年 10 月 27 日
Sure!

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

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by