Undefined function or variable 'x'.

This is a function that conducts t-tests.
x=[197, 161, 144, 162, 185, 154, 136, 130]
% y=[204, 182, 140, 178, 183, 163, 156, 143]';
%
% Usage:
% [CI, tcrit, H, Pval, tstat, df] = myttestfcn(x, y, testtype, side, alpha)
% x = vector of operations
% mu0 = hypothesized mean
%
% testtype = 0 if Welch’s t-test
% = 1 if Pooled t-test
% = 2 if Paired t-test
%
% side = 0 if two-sided test
% = 1 if left-sided test
% = 2 if right-sided test
%
% alpha = the level of the test a number on interval (0,1)
% Confidence level = 1 - alpha
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [CI, tcrit, H, df] = myttestfcn(x, y, testtype, side, alpha)

Réponses (1)

Walter Roberson
Walter Roberson le 24 Nov 2016

0 votes

Your line
x=[197, 161, 144, 162, 185, 154, 136, 130]
should be commented out. The code from "Usage:" on down should be saved in myttestfcn.m . To invoke the function you will need to go to the command line and invoke it there, such as
x=[197, 161, 144, 162, 185, 154, 136, 130];
y=[204, 182, 140, 178, 183, 163, 156, 143]';
[ci, crit, h, df] = myttestfcn(x, y, 2, 1, 0.5)

Catégories

En savoir plus sur Testing Frameworks dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by