이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
How to demonstrate analysis time in app designer window ?
조회 수: 6 (최근 30일)
이전 댓글 표시
farzad
2020년 4월 25일
Hi all
I have tic;toc in my code. How can I display the analysis time in an edit field as : hrs:minutes:seconds ?
should it be numeric or text edit field ?
채택된 답변
Ameer Hamza
2020년 4월 25일
Text edit field will be more suitable. See the attached app.
댓글 수: 31
farzad
2020년 4월 27일
Thank you very much Ameer, I create an editfield value changed, and using the toc, nothing appears.
my main calculations are under a push button and when after the for loop I do :
app.AnalysisTimeEditField.Value = char(duration(0,0,toc));
nothing appears
Ameer Hamza
2020년 4월 27일
Is this line inside a callback function? Can you share your file where this issue happen?
farzad
2020년 4월 27일
well not the whole file, but yes, this line is inside a pushbutton
function ExecuteButtonPushed(app, event)
Ameer Hamza
2020년 4월 27일
Then it should run as documented. Can you add the checkpoint at this line, and see if this line is executed.
Ameer Hamza
2020년 4월 27일
You can find information about breakpoint here: https://www.mathworks.com/help/matlab/matlab_prog/set-breakpoints.html
farzad
2020년 4월 27일
Just nothing. since it comes from editfield into pushbutton callback, maybe I should create public property ?
farzad
2020년 4월 27일
Well I just got this window by hovering over the equation. The problem now is that this value does not move from push button function to the edit field function. I think one of the two sides of the equation should be a public property
Ameer Hamza
2020년 4월 27일
app.AnalysisTimeEditField.Value
is the property of the app. It should update the edit field.
farzad
2020년 4월 27일
I see the variable in WS as
AnalysisTimeEditField: [1×1 struct]
but the edit field is not updated : a point : I can click into this field and write in it. should it be like that ? am I using the write editfield or maybe the right setttings ?
Ameer Hamza
2020년 4월 27일
I suggest you make a simple app with just a button and edit filed, that will make it easy to debug the issue. Because I cannot see any issue with the syntax, so this is likely some unrelated problem. I guess you are directly trying to update a pre-existing app. That is making it difficult to debug this issue.
farzad
2020년 4월 27일
Thank you very much. by the way, I have this question that is not being viewed, may you kindly check it ?
farzad
2020년 4월 28일
dear Ameer, I think this method works because you put the analysistime.Value under the StartUpFcn(app) function ,
I guess it will be different if you put it under pushbutton function. for simple cases it might work. but for my structure under pushbutton , after I finish a for loop, I do the toc
and matlab demostrates that value in workspace, the problem is that the value toc is not public property ( and I actually made it public property but it did not work again ), I mean I tried to assign the value by migrating toc under the editfunction value.
and also putting it under the pushbutton the editfield value does not update.
also : I have a close all command after that, does it do anything ?
farzad
2020년 4월 28일
ok , there is clearly a difference, in your code, you have only one function for push button.
But in my code, I have one Value Changed function for the edit field , and then under the pushbutton function I try the line to change its value. aren't they overwriting ?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/288410/image.png)
farzad
2020년 5월 1일
dear Ameer, since I still have not been successfull in applying this analysis time in my code :
strangely I can update a UITable contents from my calculation, so can't understand why this one is not working.
since I had created the edit fields a few times, their callbacks are left as junk in my code while I have deleted the editfield from interface. their names do not appear on component browser but I see the function in the code and it's not ediable any solution to this ?
Ameer Hamza
2020년 5월 1일
Can you check the code browser pane? Are the callback functions still mentioned there?
farzad
2020년 5월 1일
what do you mean by code browser pane ? where I write the code ? Yes ! Exactly and that's the problem that I can not solve.those functions can not be deleted from the code
Ameer Hamza
2020년 5월 1일
If you go to the code view. You find the code browser pane on the left. See if those functions still exist here.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/289471/image.png)
farzad
2020년 5월 2일
Thank you ! yes ! this was resolved.
I tried to create it again, without callback, and only used its handle. actually it correctly gets the value when I use break point to check the parameters :
K>> app.AnalysisTimeEditField
ans =
struct with fields:
Value: '00:22:06'
but it is not demonstrated on the Edit Field. I don't know what is preventing it.
the structure of my code is :
if condition
tic
for
try
CatchME
end
end
end
close all
app.AnalysisTimeEditfield= char(duration(0,0,te))
Ameer Hamza
2020년 5월 2일
Can you create a new app and try with just an edit field, without any other elements. If it still does not work, please attach the smaller app so that I can inspect it to find the problem.
farzad
2020년 5월 2일
I did, there it works. Simply. but not in my code !! even despite doing exactly the same thing
Ameer Hamza
2020년 5월 2일
Without inspecting the actual app, there is not much that can be done. As you have also observed that it works in a standalone app. So there must be some other thing in that app that is preventing that.
farzad
2020년 5월 2일
All I have after finishing the loop :
te=toc
waitbar(1, h1, 'msg')
close all
h2 = waitbar(1,'msg');
app.EditField_7.Value = char(duration(0,0,te))
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)