Errors when running matlab program

조회 수: 9 (최근 30일)
Bob Matthews
Bob Matthews 2021년 10월 30일
편집: Image Analyst 2021년 10월 30일
Hi
I am trying to run a program named TR1 version 4
I have left the input and output paths as is and am using the data provided
When I run the program, it asks for a threshold and I enter 0.001
Here is the ouput:-
*********************************************************************************************************
Please input the threshold (positive number): 0.001
Destination =
'C:\AnalysisResult\USDJPYmin(2016.07-2016.08)\'
Destination =
'C:\AnalysisResult\USDJPYmin(2016.07-2016.08)\'
Warning: Directory already exists.
> In TR1_4_Main (line 27)
Warning: The JavaFrame figure property will be removed in a future release. For more information, see Recommendations for Java and
ActiveX Users on mathworks.com.
> In TR1_4_Profile (line 115)
In TR1_4_Main (line 29)
Error using legend (line 279)
Invalid argument. Type 'help legend' for more information.
Error in TR1_4_Profile (line 117)
legend(Filename, 'Directional Change Events', 'Overshoot Events',2);
Error in TR1_4_Main (line 29)
[CPA DCA DCCstar time prices Filepath2] = TR1_4_Profile(name,Destination,Data,threshold); % for DC profile
********************************************************************************************************
I need help in understanding the various errors
Thank you
Bob M

채택된 답변

Image Analyst
Image Analyst 2021년 10월 30일
If you're talking about legend() - the built in one and not some custom one you wrote - I don't think it takes a filename. Try
legend('Directional Change Events', 'Overshoot Events');
If you've overwritten the built-in legend() with your own, then you'll have to debug that function.
To get rid of "Warning: Directory already exists." don't call mkdir() unless the folder does not exist.
if ~isfolder(Destination)
% Only create destination folder if it does not already exist.
mkdir(Destination);
end

추가 답변 (3개)

Bob Matthews
Bob Matthews 2021년 10월 30일
편집: Bob Matthews 2021년 10월 30일
Thank you.............
Understood and implemented mkdir problem
legend() - done !
Now the output:-
********************************************
Please input the threshold (positive number): 0.001
Destination =
'C:\AnalysisResult\USDJPYmin(2016.07-2016.08)\'
Destination =
'C:\AnalysisResult\USDJPYmin(2016.07-2016.08)\'
Unrecognized function or variable 'CPA'.
Error in TR1_4_Main (line 37)
for m=1:length(CPA)-1
*************************************************
  댓글 수: 1
Image Analyst
Image Analyst 2021년 10월 30일
Set a break point on that "for" line. Then look in the workspace at your variables. Do you see CPA listed? I think not. You need to define it.

댓글을 달려면 로그인하십시오.


Bob Matthews
Bob Matthews 2021년 10월 30일
I needed to mkdir twice (as it was originally)
Working now
Many thanks
Bob M

Bob Matthews
Bob Matthews 2021년 10월 30일
편집: Bob Matthews 2021년 10월 30일
Update: I now realize that of the two output files
(1) DC Data File has many output fields missing - should be 11 fields but only 5 currently shown
(2) Profile Summary File - perfect !
So, turning to TR1_4_sub_NDC.m, I notice many lines with "%" at the start i.e. commented out
I removed those which looked like they needed to be removed
Output now:-
**********************************************************************
Please input the threshold (positive number): 0.0075
Destination =
'C:\AnalysisResult\USDJPYmin(2016.07-2016.08)\'
Unrecognized function or variable 'Filepath2'.
Error in TR1_4_sub_NDC (line 246)
xlswrite(Filepath2,headers2,'sheet1','A1');
Error in TR1_4_Main (line 20)
[sub_CPA DCA time prices ] = TR1_4_sub_NDC(name,Destination,Data,sub_threshold*threshold); % for Sub_DC profile
************************************************************************
Any help on these error understandings ?
Bob M
  댓글 수: 1
Image Analyst
Image Analyst 2021년 10월 30일
편집: Image Analyst 2021년 10월 30일
Once again you're using a variable without ever defining it. What do you think Filepath2 is? Evidently it was never defined, or at least never defined in a place that is "in scope" when you try to use it.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by