what is the easiest way to reduce the lines in the code below?

4 views (last 30 days)
muhammad choudhry
muhammad choudhry on 24 Nov 2020
Edited: dpb on 24 Nov 2020
I need to read every row but certain column in the csv file. Does anyone know how to modify the code below?
File = csvread('flowrate.csv');
1 = File(:,1)
2 = File(:,2)
3 = File(:,3)
4 = File(:,4)
5 = File(:,5)
7 = File(:,7)
8 = File(:,8)
9 = File(:,9)
10 = File(:,10)
11 = File(:,11)
Thanks in advance

Accepted Answer

dpb
dpb on 24 Nov 2020
data=csvread('flowrate.csv');
% Solution 1: Eliminate unwanted column
data(:,6)=[];
% Solution 2: Keep desired columns
data=data(:,[1:5 7:11]);
Spend some time reading and working examples <Matrices and Arrays> to learn basic MATLAB syntax.
  3 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by