Created
June 4, 2016 14:32
-
-
Save tmwatchanan/3d84ac4023bacc1aaacd75ce98060769 to your computer and use it in GitHub Desktop.
MATLAB script – any members in array A that greater than 5 will be changed into 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| A = [2 5 7 0 3 2 1 8 9] | |
| for k = 1:length(A) | |
| if A(k) <= 5 | |
| B(k) = A(k); % insert ; to disable internal message of this step | |
| else | |
| B(k) = 5; % insert ; to disable internal message of this step | |
| end | |
| end | |
| disp(B) % display the value of B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment