Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I followed the instructions for Interactive Fitting (http://ww​w.mathwork​s.com/help​/matlab/da​ta_analysi​s/interact​ive-fittin​g.html#bsw​ij4t) the generated function will not accept variables of types double or single - why?

1 回表示 (過去 30 日間)
Linda Head
Linda Head 2016 年 6 月 30 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I am using data that is generated from measurements of pupil diameter vs. light levels. The step that generates a .m file for the function works fine and I renamed the function but when i enter the X1 and Y1 vectors and attempt to run the function I get the following error for either single or double type data variables. What type should be used?
Undefined function 'LDvslnlux' for input arguments of type 'single'.

回答 (2 件)

Tien Tran
Tien Tran 2016 年 7 月 1 日
Hi Linda When you generate a code file, you can use as following: We have a function Linda(X1, Y1, valuesToEvaluate1), so, you can write Linda(x,y,10) on the Command Window with x, y are new data and having the same size, 10 is an x-value for a marker. The new plot matches the appearance of the figure from which you generated code except for the y data values
  2 件のコメント
Linda Head
Linda Head 2016 年 7 月 1 日
This is exactly what I did but I get the error that the function will not accept input arguments (X1, Y1) that are of type 'single' or of type 'double' - what type should I use?
Tien Tran
Tien Tran 2016 年 7 月 1 日
編集済み: Tien Tran 2016 年 7 月 1 日
For example:
You type a syntax: Linda(randn(20,1),10*randn(20,1),9) on the Command Window
It will generate a new plot that fit with your new data (X1 = randn(20,1); and Y1 = 10*randn(20,1) ); X1 and Y1 are a cell array not a single or double point.

Walter Roberson
Walter Roberson 2016 年 7 月 1 日
is not the name of any Mathworks provided function, and it is not part of the File Exchange either. It does not seem to be anywhere else on the Internet.
You mentioned renaming a function. If you renamed it to LDvslnlux then make sure your file begins
function LDvslnlux
(possibly with some parameters)
and make sure that it is stored in LDvslnlux.m . Watch out, for example, for 1 (the digit) comared to l (lower-case L) and note that if your named your file ldvslnlux.m instead then the file would not be considered to match the function name LDvslnlux
  1 件のコメント
Linda Head
Linda Head 2016 年 7 月 1 日
Thank you for your comments - the function will not run regardless of what i name it and save it as - i still get the error:
Undefined function 'createfigure' for input arguments of type 'double'.
I will delete and start over, maybe I made a mistake elsewhere. Thanks, Linda

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by