Want to create a matrix from a an existing excel spreadsheet in a specific column

1 view (last 30 days)
So I currently have this as the start of my code
inputdata=xlsread('01.csv') with input data being a 5004x19 matrix
In the 5th collum I would like to locate all of the cells that contain a 0 in them and create them into a seperate matrix called 'Zeros'
Thankyou

Answers (1)

Mark Sherstan
Mark Sherstan on 11 Dec 2018
I would be careful naming the variables zeros as that is used in MATLAB as a predfined function. This will do the trick for you though:
inputData = randi([0 10],5004,19);
idx = find(inputData(:,5) == 0);
zeroMatrix = inputData(idx,5);

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!