現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
rainflow function usage in app designer causes the figure window open
1 回表示 (過去 30 日間)
古いコメントを表示
farzad
2020 年 4 月 2 日
Hi All
I have to use rainflow function in my application. but it causes the figure window open despite I have turned off the visibility. is there any solution to that ?
f = figure('visible', 'off');
TT = timetable(tt,B);
rainflow(TT);
title(strcat(filename,'Histogram y'));
saveas(gcf,strcat(filename,'Histogram-y.png'));
採用された回答
Walter Roberson
2020 年 4 月 2 日
When you do not specify output arguments for rainflow() then it calls a function to plot the results. Unfortunately there are a couple of careless lines in the plotting function that bring the resulting axes into focus, and that results in the plot becoming visible.
The work around is to request the output variables from rainflow() and do the plotting yourself.
I will file a bug report about the problem with accidental focus.
21 件のコメント
farzad
2020 年 4 月 2 日
thank you Walter
where are these careless lines ? if inside MATLAB function library, like inside the rainflow function, could they be edited by the user ?
Walter Roberson
2020 年 4 月 2 日
In R2020a, line 254
axes(p1)
axes tight
should be
axes(p1, 'tight')
and a few lines further down, remove
axes(p2)
without making any other change for p2.
farzad
2020 年 4 月 2 日
and, how can I find the rainflow function ? how and where to search ? in install directory ? command prompt ?
farzad
2020 年 4 月 3 日
Thank you so much, a little problem : It's read only and writing protected ! what should I do ?
Walter Roberson
2020 年 4 月 3 日
Make a copy under a different name and modify the copy and call that.
farzad
2020 年 4 月 4 日
I tried again, I had to close MATLAB. I applied that change. but Now the histograms do not work. I mean, with no error, I get no histogram saved , and the code stops as soon as it gets to histogram function
farzad
2020 年 4 月 4 日
@Walter Roberson shall you please write the very original lines ? I wrote these , to set back to default, but it's not working and giving me error of invalid handles. I think I am mistaking the places to input the axes commands
% Resize the plots, make the time series plot smaller.
p1p = get(p1,'position');
p1p(2) = p1p(2)+p1p(4)/2;
p1p(4) = p1p(4)/2;
set(p1,'position',p1p)
p1p = get(p1,'position');
p2p = get(p2,'position');
p2p(4) = 0.75*(p1p(2)-p2p(2));
set(p2,'position',p2p)
% Make the time series plot tight in x and give a margin in y
axes(p1)
axes tight
yl = signal.internal.nvh.plotLimits(get(p1,'ylim'));
set(p1,'ylim',yl);
axes(p2)
xl = signal.internal.nvh.plotLimits(get(p2,'xlim'));
set(p2,'xlim',xl);
yl = signal.internal.nvh.plotLimits(get(p2,'ylim'));
set(p2,'ylim',yl);
farzad
2020 年 4 月 4 日
Dear Walter, Shall you very please paste or attach the very original rainflow function here ? I did a mistake not to hold the original one
Walter Roberson
2020 年 4 月 4 日
The function is copyright by Mathworks, so I cannot post it. However, above in https://www.mathworks.com/matlabcentral/answers/514771-rainflow-function-usage-in-app-designer-causes-the-figure-window-open#comment_819779 I showed the original lines as well as the revised lines.
farzad
2020 年 4 月 4 日
True. Thank you walter. but I also found out that it had to be
axes(p1)
axes ('tight')
Walter Roberson
2020 年 4 月 4 日
axes tight
and
axes('tight')
are the same thing as far as MATLAB is concerned. In MATLAB, when you use the syntax
NAME ARG1 ARG2 ARG3
and there is no '(' at the beginning of ARG1,
then that is treated the same as
NAME('ARG1', 'ARG2', 'ARG3');
farzad
2020 年 4 月 4 日
Thank you dear Walter, but anyway, that solution for me did not work. I mean the merging of 2 lines and removal of axes p2 . now I am back to the original version but I appreciate if you give me a suggestion, or I just leave it as it is
farzad
2020 年 4 月 5 日
ok , new problem here :
Since in my code, as you know , I use waitbar and that is a figure as well, when the processing is done,
I have 6 figures of histogram open plus this waitbar.
if I do close all , also the waitbar will open. since in the histogram function I do :
rainflow(TT);
title(strcat(filename,'Histogram1'));
saveas(gcf,strcat(filename,'Histogram-1.png'));
I was thinking to close each histogram immediately after being opened , without using close all. I thought
rf=rainflow(TT);
title(strcat(filename,'Histogram1'));
saveas(gcf,strcat(filename,'Histogram-1.png'));
close(rf)
would work, but instead, no histogram was opening and no histogram image was being saved.
do you have any suggestion ?
Walter Roberson
2020 年 4 月 6 日
Remember to drawnow() before the saveas().
You might need to pause(1) instead to give the drawing time to finish.
farzad
2020 年 4 月 6 日
dear Walter, the first code saves the plots correctly. but I want to close the plot after saving, without using close all, to avoid closing waitbar
farzad
2020 年 5 月 11 日
編集済み: farzad
2020 年 5 月 11 日
dear Walter, Just about this question, about modifying the axes(p1), I tried your suggestions again on the rainflow.m function file of matlab abd re-ran the code and got this error :
Error: Incorrect input args for constructing axes object
the reason is , one of them is axes, the other one is axis. and the new mixing does not work, cause probably axes does not get more than one argoment
axes(p1);
axis('tight');
It would be really great to have a solution to this
farzad
2020 年 5 月 12 日
I did this. Now I have one single figure open and its content changes , given that I have to make several rainflow figures during the run. but I will have this one figure opend.
even If I do
f = figure('visible','off');
It will create another figure, and the ONE figure will remain open
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Vibration Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)