Nonfinite endpoints or increment for colon operator in index

58 ビュー (過去 30 日間)
Marco Baglio
Marco Baglio 2016 年 9 月 24 日
コメント済み: Walter Roberson 2016 年 9 月 25 日
Hello everyone, I'm creating a code for plotting a function. If I use such function with a proper code it works; however in the GUI, with the same input, I receive the following message:
"Nonfinite endpoints or increment for colon operator in index"
The line of the code is:
q(1:(lf1-1))=qr1*(f(1:(lf1-1))/fr1).^s1;
where lf1 is given by: lf1=round(ft1/delf)+1 (delf is computed inside the function, it isn't 0)
I obtain the input from another gui in the following format:
ft1=str2double(getappdata(0,'ft1'));
Thanks in advance

採用された回答

Walter Roberson
Walter Roberson 2016 年 9 月 24 日
編集済み: Walter Roberson 2016 年 9 月 24 日
I suspect that you have stored ft1 in appdata as numeric rather than string, and that str2double() applied to the numeric value is then returning NaN.
After you do the
ft1=str2double(getappdata(0,'ft1'));
you should debug by displaying class(ft1) and ft1 itself
Another possibility is that in your
q(1:(lf1-1))=qr1*(f(1:(lf1-1))/fr1).^s1;
that fr1 is 0. Where is it getting fr1 from?
  4 件のコメント
Marco Baglio
Marco Baglio 2016 年 9 月 25 日
Sorry I don't understand what you mean. In the GUI where I obtain the parameters I wrote:
ft1=get(handles.ft1,'String');
setappdata(handles.ft1,'ft1',ft1);
I verified that in this phase the parameter is a number and not NaN! In the second GUI I wrote:
ft1=str2double(getappdata(0,'ft1'));
This returns NaN.
Walter Roberson
Walter Roberson 2016 年 9 月 25 日
You have getappdata(0,...) which tries to get data from the root graphics object, but the data is stored on handles.ft1

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by