Using dynamicDateTicks external function in appDesigner --> built-in 'zoom' function Error
5 ビュー (過去 30 日間)
古いコメントを表示
I have an app that plots animatedline, and thus I can't plot datetime ticks directly to x-axis. So, I used dynamicDateTicks function, for x-ticks. Additionally, from this function the date and time dynamically change with zooming and panning, like when user zoom the graph the ticks changes from years to months.
In editor everything is working perfect, but in appDesigner it's showing the ticks but UI-Axis is not updating date-time after zooming and panning. It gives the error in line 74, where zoom and pan functions are located.
Here's the code of dynamicDateTicks having issues:
% Set the zoom, pan and datacursor callbacks
figH = get(axH, 'Parent');
if iscell(figH)
figH = unique([figH{:}]);
end
if length(figH) > 1
error('Axes should be part of the same plot (have the same figure parent)');
end
z = zoom(figH); % Line 74
p = pan(figH);
d = datacursormode(figH);
set(z,'ActionPostCallback',@updateDateLabel);
set(p,'ActionPostCallback',@updateDateLabel);
set(d,'UpdateFcn',@dateTip);
I know that zoom and pan function in UIAxes can't operate in this way. So, is there any trick to use them properly.
1 件のコメント
Brian Yellen
2023 年 6 月 20 日
Hi Umair,
I am having the same issue. Did you ever get this figured out?
Thanks! ~Brian
回答 (1 件)
Rahul
2025 年 6 月 9 日
I was able to reproduce the issue that you were facing while trying to use 'dynamicDateTicks' external function in MATLAB App Designer.
I observed that the example given for 'dynamicDateTicks' in MATLAB File Exchange refers to the 'datenum' function and it is making use of 'dynamicDateTicks' to modify those numbers to date values which are then being plotted.
A workaround in this scenario would be to use 'datetime' function provided by MATLAB which when being used along an axis now gives the ability to pan and zoom which was your original use-case.
The following MathWorks documentation can be referred:
Thanks.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Exploration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!