I was wondering whether there was a way to do the following, without writing a function or a for loop:
int[] ma = (3,4,4,5,6,7);
ma += 5;
thus, adding 5 to all elements in the array. Matlab allows for such a convenient shortcut.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Short answer: No you can’t. You need to write a loop to do it.