The double for loop can be done in a vectorized way in a single line of code instead of 9 lines of code (this is how most MATLAB programmers would do it):
X = input("Donner une matrice dont les l'element sont ts differnets de zero");
M = X >= 0;
disp(M)
A=M.*X
B=(1-M).*X
B = ~M .* X;
The code basically gets the positive and negative elements according to what I said in my comments. Most (I hope) MATLAB programmers would also have put comments into that code, and would have chosen more descriptive variable names so other people, like you for example, could follow the code easier and not be left scratching their head wondering what the code does.
3 件のコメント
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/718495-what-this-programe-do#comment_1266695
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/718495-what-this-programe-do#comment_1266695
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/718495-what-this-programe-do#comment_1266705
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/718495-what-this-programe-do#comment_1266705
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/718495-what-this-programe-do#comment_1266710
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/718495-what-this-programe-do#comment_1266710
サインインしてコメントする。