Undefined function 'trend' for input arguments of type 'double'

4 views (last 30 days)
Retno Purwaningsih
Retno Purwaningsih on 23 Oct 2021
Answered: Dave B on 23 Oct 2021
Hai everyone, i facing some problem with the script. I'm using trend function but had an error like this
Undefined function 'trend' for input arguments of type 'double'.
Error in script_msl_v2 (line 14)
ud=trend(data{:,4:end},[],2,'omitnan');
with this script
clear;
clc;
format longG;
f = dir('D:/full_Data_Cryosat_c2p0004.txt');
A=1:length(f);
D = f(A).name;
Insufficient number of outputs from right hand side of equal sign to satisfy assignment.
ff=D(:,19:25)
data=readtable(D,'HeaderLines',0);
rata2=mean(data{:,4:end},2,'omitnan');
standar_deviation=std(data{:,4:end},[],2,'omitnan');
ud=trend(data{:,4:end},[],2,'omitnan');
ref=data{:,1};
lat=data{:,2};
lon=data{:,3};
msl=[ref lat lon rata2 standar_deviation]
file_name_msl=['msl_' ff '.txt']
dlmwrite(file_name_msl, rata2, 'delimiter', '\t');
file_name_data=['data_msl_' ff '.txt']
dlmwrite(file_name_data, msl, 'delimiter', '\t','precision',10);
What should i do to solve that?
Thanks for helping

Answers (1)

Dave B
Dave B on 23 Oct 2021
If you're trying to use a function you got from elsewhere (e.g. downloaded from file exchange) you likely need to add the directory containing that function to the MATLAB path. For an easy graphical interface for managing the path, just run: pathtool
If you're expecting trend to be a builtin function in MATLAB, I think it's not...what were you expecting it to do?
which trend
'trend' not found.

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by