I think that '180' it 'pi' in this case.
Question
I have a vector [A] which includes positive and negative values A = [1 4 5 2 -3 4 5 7 -6 -6]. I want to change those negative values by adding -180 to them, so my new vector will be like this A = [1 4 5 2 -183 4 5 7 -186 -186]. Any idea how find that? So far I tried this but not working for i = 1:10 for j = 1:1 if A(i,j)<=0 A(i,j) = A + -180; end end end
Expert Answer
Kshitij Singh
PhD Expert
Answered Aug 23, 2026
A = [1 4 5 2 -3 4 5 7 -6 -6]; t = A < 0; A(t) = A(t) - 180;
ADD
May be use the following:
A = mod(A,180);
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →