Add a constant to just one column
52 views (last 30 days)
Show older comments
I am trying to add 1900 to entries in my first column of a matrix to make them a more accurate date. 89 42 49 55 72 63 68 77 82 76 67 90 45 50 56 59 62 68 75 77 75 66 91 44 43 60 60 60 65 69 74 70 70.
I am reading in this matrix but want it changed to 1989 42 49 55 72 63 68 77 82 76 67 1990 45 50 56 59 62 68 75 77 75 66 1991 44 43 60 60 60 65 69 74 70 70
2 Comments
mohammed
on 13 Feb 2014
Edited: mohammed
on 14 Feb 2014
Dear Dakota Bateman
i haven`t understand your question completely but i think you want too add some constant value to first column of your matrix;
let
a = randi(5,5,5);
Result = [(a(:,1)+2),a(:,(2:end))]; % here i am adding 2 to my first column
i hope it will help you.
Image Analyst
on 14 Feb 2014
That's because he didn't format his post. Dakota needs to read this: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
Answers (1)
See Also
Categories
Find more on R Language in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!