0

I want to save the output out in the form of a column vector which is currently coming out as

ans(:,:,1) =
 0
ans(:,:,2) =
 0
ans(:,:,3) =
 0
ans(:,:,4) =
 0
ans(:,:,5) =
 0
ans(:,:,6) =
 0
ans(:,:,7) =
-5.5511e-017

function [out]= myfun1(in)
in= importdata('X.dat');
l= length(in);
dt=0.05;
l1=(l-1)*dt+1;
ts = timeseries(in, 1:.05:l1);
ts1= resample(ts, 1:1:l1);
out= ts1.data;
  • [`squeeze`](http://www.mathworks.com/help/matlab/ref/squeeze.html) it. – Divakar Aug 09 '15 at 05:26
  • Thanx! It worked to get a column vector. What should I do if I want to get a row vector directly from the output and not from taking the transpose of column vector formed after squeeze? – user5207497 Aug 09 '15 at 08:35
  • 1
    `reshape(out,1,[])` might be the solution then. – Divakar Aug 09 '15 at 08:36

1 Answers1

0

I think you might have a problem with the output as a whole. I assume that you want to resample the vector 'in' at sample points 1:1:l1. Resample should be called as:

resample(timeseriesVector, UpsampleValue, DownsampleValue)

This will generate a new timeseries vector at the rate of UpsampleValue/DownsampleValue.

I am sorry if I have misinterpreted your intentions. If you could provide some basic sample data it might be easier to debug.

mpaskov
  • 1,234
  • 2
  • 11
  • 21