首页 \ 问答 \ 在GUI matlab中运行函数(Running Functions in GUI matlab)

在GUI matlab中运行函数(Running Functions in GUI matlab)

继续我对抗GUI的斗争,我遇到了另一个路障。

我成功地创建了一个按钮,以字符串的形式打开一个文件,并将其放置在我的GUI中的文本框中。

 [filename, pathname] = ...
     uigetfile({'*.m';'*.mdl';'*.mat';'*.*'},'File Selector');

set(handles.Textbox1, 'string', fullfile(pathname,filename));

但现在我似乎无法在获取的文件上使用函数。 我试过了

  str = get(handles.Textbox1,'string');
Histogram(str); %Histogram is a function that I created.

但即时获得以下错误

??? 错误使用==>直方图输入参数太多。

错误==> VarunGUI> pushbutton2_Callback at 94直方图(str);

错误在==> gui_mainfcn在96 feval(varargin {:});

错误在==> VarunGUI在42 gui_mainfcn(gui_State,varargin {:});

错误在==> @(hObject,eventdata)VarunGUI('pushbutton2_Callback',hObject,eventdata,guidata(hObject))

??? 评估uicontrol回调时出错

我的代码是用来调用函数的,还是函数本身? 我无法理解如何修改函数以在被调用的图像上工作,所以这可能是我的问题,函数以下面的代码开始。

function Histogram
clear;
clc;
fid = fopen('');
myimage = fread(fid, [512, 683], '*uint8');
fclose(fid);

是否需要在''中放置某个变量以使GUI以我希望的方式工作? 问题有点长,但请告诉我,如果您需要查看任何其他信息以帮助我,那么任何指导或技巧都会很棒。 谢谢!


Continuing my struggle against GUI's, I have run into another road block.

Ive successfully created a button that opens a file as a string, and places it in a text box in my GUI like so.

 [filename, pathname] = ...
     uigetfile({'*.m';'*.mdl';'*.mat';'*.*'},'File Selector');

set(handles.Textbox1, 'string', fullfile(pathname,filename));

But now I cannot seem to use a function on the acquired file. Ive tried doing

  str = get(handles.Textbox1,'string');
Histogram(str); %Histogram is a function that I created.

But im getting the following errors

??? Error using ==> Histogram Too many input arguments.

Error in ==> VarunGUI>pushbutton2_Callback at 94 Histogram(str);

Error in ==> gui_mainfcn at 96 feval(varargin{:});

Error in ==> VarunGUI at 42 gui_mainfcn(gui_State, varargin{:});

Error in ==> @(hObject,eventdata)VarunGUI('pushbutton2_Callback',hObject,eventdata,guidata(hObject))

??? Error while evaluating uicontrol Callback

Is my code for calling the function to blame, or is the function itself? I'm having trouble understanding how to alter the function to work on the called image, so that may be my problem, the function begins with the following code.

function Histogram
clear;
clc;
fid = fopen('');
myimage = fread(fid, [512, 683], '*uint8');
fclose(fid);

Is there a certain variable I need to place in the '' to make the GUI act in the manner to which I would like it? Question ran a little long, but please tell me if there is anything else you need to see in order to assist me, any guidance or tips would be great. Thanks!


原文:https://stackoverflow.com/questions/17174611
更新时间:2023-04-29 15:04

最满意答案

Data.Time.LocalTime.TimeZone.Olson允许读取时区规范文件,并提供TimeZoneSeries值,这些值封装了各种奇怪的时区和夏令时。

时区很复杂,因此您无法从"Europe/Berlin"等标识符中完全推断出TimeZone ,而无需为其提供实际的UTC时间。 这就是TimeZoneSeries解决的问题,具有许多转换功能。


Data.Time.LocalTime.TimeZone.Olson allows for reading time zone specification files and offers TimeZoneSeries values which encapsulates the various oddities of time zones and Daylight Saving Time.

Time Zones are complex, so you can't completely infer a TimeZone from an identifier like "Europe/Berlin" without giving it an actual UTC time from which to work. That's what TimeZoneSeries solves, with a number of conversion functions.

相关问答

更多
  • SELECT now()::timestamp 就这样。 演员阵营将时间戳转换为您的时区的当前时间戳。 这也是在Postgres中实现标准SQL函数LOCALTIMESTAMP方式。 如果您不在多个时区中运行,那就很好。 否则切换到timestamptz added_at 。 区别? 在Rails和PostgreSQL中完全忽略时区 SELECT now()::timestamp That's all. The cast converts the timestamp to the current tim ...
  • 您可以使用getAvailableIDs()获取所有支持的ID 然后循环supportedID数组并与您的字符串进行比较。 例: String[] validIDs = TimeZone.getAvailableIDs(); for (String str : validIDs) { if (str != null && str.equals("yourString")) { System.out.println("Valid ID"); } } You can g ...
  • 时区位置Web服务 Google TimeZone API GeoNames的 TimeZoneDB AskGeo - 商业(但可以说比GeoNames更准确 ) GeoGarage - 商业,专注于航海时区。 原始时区地理位置数据 tz_world - 来自Eric Muller的原始shapefile数据 时区边界生成器 - 从OpenStreetMaps地图数据构建时区shapefile。 whereonearth时区 - 与WOEDB数据合并的GeoJSON版本 CityTimeZones - 包含 ...
  • 首先,回答你的具体问题: 所有基于缩写的标识符应被视为弃用。 它们不足以识别保留所有细节的特定时区。 例如,您可以在此处查看所有使用中欧时间的地点。 他们中的一些人整年都使用CET ,其中一些人在冬季使用CET ,而在夏季使用CEST 。 其中,并非所有人都使用相同的DST过渡日,或者在他们的历史中有相同的时区偏移量。 CET没有足够的信息来决定使用哪组规则。 使用GMT或UTC是相对安全的,因为这些是明确的。 但是使用Etc/GMT或Etc/UTC会更加正确。 如果你只挑一个,恕我直言,它应该是Etc/U ...
  • Data.Time.LocalTime.TimeZone.Olson允许读取时区规范文件,并提供TimeZoneSeries值,这些值封装了各种奇怪的时区和夏令时。 时区很复杂,因此您无法从"Europe/Berlin"等标识符中完全推断出TimeZone ,而无需为其提供实际的UTC时间。 这就是TimeZoneSeries解决的问题,具有许多转换功能。 Data.Time.LocalTime.TimeZone.Olson allows for reading time zone specificatio ...
  • (我重写了我的回复,之前我误解了这个问题)。 以下是如何从缩写转换timeZone的示例: NSTimeZone* localTimeZone = [NSTimeZone localTimeZone]; NSString* localAbbreviation = [localTimeZone abbreviation]; 要从localAbbreviation转换回来,只需要重新创建timeZone: NSTimeZone* timeZoneFromAbbreviation = [NStimeZone t ...
  • 您可以使用以下方法解析带偏移量的ISO 8601字符串。 如果字符串没有偏移量,则假定为Z(即每ECMA-262的 UTC): /* Parse an ISO string with an offset ** e.g. '2014-04-02T20:00:00-0600' ** '2014-04-02T20:00:00Z' ** ** Allows decimal seconds if supplied ** e.g. '2014-04-02T20:00:00.123-0600' ** ...
  • 最简单的方法是使用DateTime : $t = new DateTime(); $t->setTimestamp( $time=time() ); $t->setTimeZone(new DateTimeZone("America/Denver")); print $t->format(DateTime::RFC850); 可以随意更改时区以使格式化功能重新计算本地时间。 The easiest approach would be to use DateTime with: $t = new DateT ...
  • 接受的答案太难了。 操纵偏移量是日期时间库的范畴。 自己做这样的工作是浪费你的时间,并可能成为错误的来源。 旧的java.util.Date/.Calendar类非常麻烦。 避免他们。 而是使用java.time或Joda-Time。 java.time Java 8及更高版本内置了一个新的java.time框架。 灵感来自Joda-Time ,由JSR 310定义,并由ThreeTen-Extra项目扩展。 请参阅教程 。 困惑的问题 你的问题很困惑。 你说你想忽略时区,但是你接受了一个确实解析并处理时区 ...
  • 您可以通过覆盖AppKernel函数来设置默认时区。

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)