Can I tell matlab to go only through certain lines of a code?

2 ビュー (過去 30 日間)
MC3105
MC3105 2014 年 11 月 11 日
回答済み: the cyclist 2014 年 11 月 11 日
Hey everyone,
I am running a code that tells matlab to go through a different code with filename calculation.m
Is it possible to tell matlab to go only through certain lines of that calculation code? For example go only from line 1 to line 50?
Thanks!

回答 (1 件)

the cyclist
the cyclist 2014 年 11 月 11 日
You can't reference line numbers, but I suppose you could fake it by passing an argument.
Calling routine:
y = calculation(x,stopLine)
Your calculation function:
function y = calculation(x,stopLine)
% 50 lines of code here
if stopLine==50
return
end
% 50 more lines of code here
if stopLine==100
return
end
% etc
end

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by