how to specify the particular column numbers of a matrix in for loop

1 view (last 30 days)
I have a matrix withy dimension 1801 by 88. I want to select the column number 70:75 in for loop for analysis. If I start with
for i=1:1801
for j=1:5
It is only taking the first five columns. But I want get five columns having column number 70:75.
How can I do this.

Accepted Answer

KSSV
KSSV on 10 Aug 2020
for i = 1:1801
for j = 70:75
  7 Comments
KSSV
KSSV on 10 Aug 2020
clc; clear all ;
load ampli_512.dat;
load freq_512.dat;
load phase_512.dat;
pos = 70:75 ;
Am = zeros(1801,6) ;
Ph = zeros(1801,6) ;
Fq = zeros(1801,6) ;
for i=1:1801
for j=1:6
Am(i,j)=ampli_512(i,pos(j));
Ph(i,j)=phase_512(i,pos(j));
Fq(i,j)=freq_512(i,pos(j));
end
end

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices 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!