2

I am trying to read data files each containing one column and 4097 rows. But my function needs total numbers of rows with even number (means 4096). So I used the MATLAB command x(2:length(x))). But my 'x' value in this command is a(:,k) and the issue is MATLAB cannot call or index into a temporary array. Any solution to this? I thank all for the support. The code is:

for k = 1:9
with filename = sprintf('F00%d.txt',k);
a(:,k) = load(filename);
x = a(:,k)(2:length(a(:,k)));
w = tqwt(p,1,3,3);
[a1,a2,a3,a4]= deal(w{:});

 m(a1,1) = mean(a1);
 s(a1,1) = std(a1);
 ma(a1,1) = max(a1);
 mi(a1,1) = min(a1);
Dattaprasad
  • 105
  • 2
  • 12

1 Answers1

3

Unfortunately, you have to split x = a(:,k)(2:length(a(:,k))); into two lines as shown below:

temp = a(:,k);
x = temp(2:length(a(:,k)));

Please read:

  1. Indexing of a function's return
  2. How can I use indexing on the output of a function?
Community
  • 1
  • 1
User1551892
  • 3,236
  • 8
  • 32
  • 52