用于 GUI 的 MATLAB 日期选择弹出日历
有谁知道在 MATLAB gui 中显示弹出日期选择日历的方法吗?我知道金融工具箱有一个uicalendar
功能,但不幸的是我没有那个工具箱。
我有一种预感,我将不得不使用一些 Java 或其他语言来完成这个任务,但我对此一无所知。
我正在寻找与此类似的东西:
(来源:welie.com)
在用户选择日期后将返回日期字符串。
Does anyone know of a method to display a popup date selection calendar in a MATLAB gui? I know the financial toolbox has a uicalendar
function, but unfortunately I don't have that toolbox.
I have a hunch I'm going to have to use some Java or some other language for this one, which I know nothing about.
I'm looking for something similar to this:
(source: welie.com)
which would return a date string after the user selects the date.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这里有两种方法可以在 Matlab 中为您提供具有专业外观的日历组件,而无需太多编程工作:
使用 Java 日历组件(例如,这些 或 这些)。下载相关的 Java 类或 Jar 文件后,将其添加到静态 Java 类路径(使用 Matlab 命令提示符中的
edit('classpath.txt')
命令)。最后,使用内置的javacomponent函数将组件放置在Matlab图形窗口中。如果您使用的是 Windows 操作系统,则可以嵌入任何可用的 Active-X 日历控件。使用内置的 actxcontrolselect 函数选择您最喜欢的日历控件(例如,Microsoft Office 的“日历控件 11.0”- MSCAL.Calendar.7 - 会自动安装Office 2003;或“Microsoft 日期和时间选择器控件 6.0”- MSComCtl2.DTPicker.2,或...)。然后使用actxcontrol函数将组件放置在Matlab图形窗口中。
Matlab 有一些非常有用的内置日历(日期选择)控件 - 我发布了 an今天关于它们的文章
Here are two approaches that would give you a professional-looking calendar component in Matlab without too much programming work:
Use a Java calendar component (for example, one of these or these). Once you download the relevant Java class or Jar-file, add it to your static Java classpath (use the
edit('classpath.txt')
command from the Matlab Command Prompt). Finally, use the built-in javacomponent function to place the component in your Matlab figure window.If you are using a Windows OS, you can embed any Active-X calendar control that is available. Use the built-in actxcontrolselect function to choose your favorite calendar control (for example, Microsoft Office's "Calendar Control 11.0" - MSCAL.Calendar.7 - which is automatically installed with Office 2003; or "Microsoft Date and Time Picker Control 6.0" - MSComCtl2.DTPicker.2, or ...). Then use the actxcontrol function to place the component in your Matlab figure window.
Matlab has some pretty useful built-in calendar (date-selection) controls - I posted an article about them today
不幸的是,我没有太多时间来获得更完整的答案,但我会尝试使用
uitable
创建一个表并定义CellSelectionCallback
来获取日期。这里有一些可以帮助您入门的信息:
I don't have much time for a more complete answer, unfortunately, but I'd try
uitable
to create a table and to define theCellSelectionCallback
to get the date.Here's a bit to get you started:
我从 calendar() 函数 开始它输出一个包含任意月份日历的矩阵。我假设您可以将其与用户可点击的界面结合起来以检索特定日期?
下面的代码确实很难看,但可以帮助你开始......
I'd start with the calendar() function which outputs a matrix containing the calendar for any month. I assume you could combine this with a user-clickable interface to retrieve a specific date?
The following code is really ugly, but could help you get started...