Remove zeros from matrix

Please help me trim the zeros off the top the the X matrix.
Thanks
function Beta = nnARMAParam(y, p, q, C, sigma) if nargin < 4 C = 0; end if nargin < 5 sigma = 1; end
y = y(:); N = length(y);
e = sigma * randn(N, 1);
Y = y - e;
% By = y(1:end-1) y(1:end-2) ... y(:, end-p) By = arrayfun(@(j) [zeros(j,1); y(1:end-j)], 1:p, 'UniformOutput' , false); By = [By{:}]; Be = arrayfun(@(j) [zeros(j,1); e(1:end-j)], 1:q, 'UniformOutput' , false); Be = [Be{:}];
if C == 0 cvec = []; else cvec = ones(N,1); end
X = [cvec By Be];
Beta = Y\X; % replace with nnls end

 採用された回答

Matt J
Matt J 2013 年 2 月 25 日

1 投票

idx = find(any(X,2),1);
X(1:idx-1,:)=[];

1 件のコメント

dav
dav 2013 年 2 月 25 日
Thank you very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Type Identification についてさらに検索

タグ

タグが未入力です。

質問済み:

dav
2013 年 2 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by