I have a MATLAB matrix, that is 1000×4, to use as an input for a function. I need to add a new column that contains a certain string. So how can I make a new column where all the values are ‘TEST’?
Share
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.
Since it’s a little unclear what you want, here are some options:
To make a 1000-by-4 matrix where each row is
'TEST', you can use the function REPMAT:To add
'TEST'to the end of each row of a 1000-by-4 matrix of characters, you can use the function STRCAT:If your 1000-by-4 matrix is a numeric array instead of an array of characters, you will have to use cell arrays to combine the different types of data. Here’s one way you can do this: