matlab gui - 同样的gui屏幕(matlab gui - callling the same gui screen)
我正在尝试用matlab做GUI,用户输入点作为输入和连接。
我有5个matlab文件 - screen1.m,screen2.m,screen3.m,screen4.m,globalParams.m
在globalParams我有全局参数,所以我可以使用它们从屏幕GUI到屏幕GUI。 在screen1中,用户输入节点数(例如5)。 当他按下Next按钮时,回调函数调用“
screen2();
”。 在screen2.m中,用户输入(x,y)coordiante,当他按下Next按钮时,回调函数调用“screen3();
”。现在我要求他填充Node i和Node j之间的连接(他需要填充节点i和j的数字)。 如果只有1个连接,他将按下Finish按钮,回调函数将调用“
screen4();
并且everthing是好的。 否则(有超过1个连接)他按下Next按钮,回调函数调用”screen3();
“。所以,当我们有多个连接时,我有问题再次调用screen3 ..当我打电话给下一个屏幕关闭最后一个屏幕时,还有什么方法吗? 因为当我们找到一种一次又一次调用screen3的方法时,会有很多GUI打开,它会让用户感到困惑和烦恼。
一些代码:
在screen1中,下一个按钮:
function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) screen2();
在screen2中,下一个按钮:
function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) screen3();
在screen3中,下一个按钮,然后是完成按钮:
function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) screen3(); % --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) screen4();
在screen3中我如何使用2个节点之间的连接:
function edit2_Callback(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit2 as text % str2double(get(hObject,'String')) returns contents of edit2 as a double global hopsMatrix; i = str2num(get(handles.edit2, 'string')); j = str2num(get(handles.edit1, 'string')); hopsMatrix(i,j) = 1;
I'm trying to do in matlab, GUI that the the user enters points as input and connection between them.
I have 5 matlab files - screen1.m, screen2.m, screen3.m, screen4.m, globalParams.m
in globalParams I have global params so I can use them from screen GUI to screen GUI. in screen1 the user enters the number of nodes(for example 5). when he press the Next button the callback function calls "
screen2();
". in screen2.m the user enters the (x,y) coordiante and when he press the Next button the callback function calls "screen3();
".Now I'm asking him to fill the connection between Node i to Node j.(he need to fill the numbers of node i and j). if there is only 1 connection he will press the Finish button, and the callback function will call "
screen4();
and everthing is good. Else(there is more then 1 connection) he press the Next button and the callback function calls "screen3();
". So when we have more than 1 connection I have problem calling screen3 again...Also is there some way when I'm calling the next screen to close the last screen? because when we find a way to call screen3 again and again, there will be a lot of GUI open and it can confuse and annoy the user.
some code:
in screen1, the next button:
function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) screen2();
in screen2, the next button:
function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) screen3();
in screen3, the next button and then the finish button:
function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) screen3(); % --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) screen4();
in screen3 how I'm using the connection between 2 nodes:
function edit2_Callback(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit2 as text % str2double(get(hObject,'String')) returns contents of edit2 as a double global hopsMatrix; i = str2num(get(handles.edit2, 'string')); j = str2num(get(handles.edit1, 'string')); hopsMatrix(i,j) = 1;
原文:https://stackoverflow.com/questions/21779807
最满意答案
像大多数事情一样,我认为你应该在决定之前进行衡量。 许多AWS客户非常成功地使用Lambda作为其Web应用程序的后端。
关于Lambda延迟的讨论很多,例如:
您应该测量代表您的应用及其使用的环境的延迟。
与请求延迟相关的一些重要因素:
- 冷启动=>更高的延迟
- 请求模式是冷启动的重要因素
- 如果需要在VPC中部署(ENI的附件=>更高的冷启动延迟)
- 使用CloudFront - > API网关 - > Lambda(更多层=>更高的延迟)
- 编程语言的选择(Java可能是最高的冷启动延迟,Go最低)
- Lambda环境的大小(更多RAM =>更多CPU =>更快)
- Lambda帐户和并发限制
- 预热策略
Like most things, I think you should measure before deciding. A lot of AWS customers use Lambda as the back-end for their webapps quite successfully.
There's a lot of discussion out there on Lambda latency, for example:
- you're thinking about cold starts all wrong
- Lambda call latency
- comparing Lambda performance using Node.js, Java, C# or Python
You should measure latency for an environment that's representative of your app and its use.
A few things that are important factors related to request latency:
- cold starts => higher latency
- request patterns are important factors in cold starts
- if you need to deploy in VPC (attachment of ENI => higher cold start latency)
- using CloudFront --> API Gateway --> Lambda (more layers => higher latency)
- choice of programming language (Java likely highest cold-start latency, Go lowest)
- size of Lambda environment (more RAM => more CPU => faster)
- Lambda account and concurrency limits
- pre-warming strategy
相关问答
更多-
为什么不拥有一个简单的API,如果它们具有正确的Api密钥,则它将为原始的Firebase REST API提供一个Oauth标记 它会更安全,因为只有您可以创建令牌,因为只有您拥有服务帐户私钥。 还可以节省您制作整个REST API的麻烦。 此外,Oauth令牌相对快速到期,因此它比您提供的正常密钥风险要小 我个人已经创建了自己的Servlet,用户在使用ID传递组合进行身份验证时发布他们的数据。 在Servlets中,我使用Firebase提供的默认REST API和我的servlet中生成的Oauth ...
-
AWS Lambda中的API超时?(API timeouts in AWS Lambda?)[2024-01-11]
您需要从VPC中删除Lambda函数(如果它不需要VPC资源访问,那么将其添加到VPC中只会引入性能问题),或者您需要确保Lambda函数位于您的私有子网中VPC和该子网有通往NAT网关的路由。 You either need to remove the Lambda function from your VPC (if it doesn't need VPC resource access then adding it to the VPC only introduces performance issu ... -
像大多数事情一样,我认为你应该在决定之前进行衡量。 许多AWS客户非常成功地使用Lambda作为其Web应用程序的后端。 关于Lambda延迟的讨论很多,例如: 你在考虑冷启动都是错的 Lambda呼叫延迟 使用Node.js,Java,C#或Python比较Lambda性能 您应该测量代表您的应用及其使用的环境的延迟。 与请求延迟相关的一些重要因素: 冷启动=>更高的延迟 请求模式是冷启动的重要因素 如果需要在VPC中部署(ENI的附件=>更高的冷启动延迟) 使用CloudFront - > API网关 ...
-
据我了解,Node.js是单线程的,所以我认为我不会超过这个限制。 我没有使用子进程,异步库在这方面也不是那么好。 Node.js是事件驱动的 ,而不是单线程的。 Javascript引擎在单个线程(事件循环)上运行,并将I / O操作委托给处理其线程池和异步操作的内部库( libuv )。 async不会自己打开子进程,但在幕后,无论是发出HTTP请求还是与文件系统进行交互,都要将这些操作委托给libuv 。 换句话说,您已经使用资源限制很好地回答了您自己的问题: 在此上下文中,我可以在AWS Lambd ...
-
因为我有将Codeigniter基础Web系统部署到AWS的经验,所以我可以帮助您。 首先,问题的安全性... AWS不会有太大的帮助。 是的,它默认有更多的安全层。 但如果你的应用程序本身不安全,这是没有用的。 所以在这里: 如果你想快速部署,我建议通过EC2,安装一个配置了LAMP的图像(来自市场,应该有免费的图像,你可以使用) 上传到服务器,配置正确的配置 然后它应该按照它的意图工作。 但是如果你想利用自动缩放功能 为PHP环境设置Elastic Beanstalk(EB) 将所有设置配置如下,以压缩 ...
-
用于SOAP / REST转换的AWS API网关和Lambda函数(AWS API Gateway & Lambda Function for SOAP / REST Conversion)[2023-07-18]
对于问题1和2:是的,在Lambda函数中执行SOAP请求和转换是正确的。 问题3:要在API Gateway处理身份验证,您可以使用名为Custom Authorizer的单独Lambda函数。 您还可以在Custom Authorizer Lambda函数中对API Gateway端点进行授权。 For Question 1 & 2: Yes, it is correct to do the SOAP request and transformation in the Lambda function. ... -
为AWS Lambda函数使用REST API和Node.JS(Consuming an REST API with Node.JS for a AWS Lambda Function)[2023-07-07]
几乎相同的。 const https = require('https'); var body = ""; const url = "https://api.darksky.net/forecast/your-secret-key/37.8267,-122.4233" var req = https.request(url, (res) => { res.on('data', (d) => { body += d; }); res.on('end', () => { ... -
可以将多个API网关路由直接指向相同的Lambda函数。 如何设置这取决于你如何维护你的基础设施。 例如,如果您将CloudFormation与无服务器应用程序模型(SAM)一起使用,我推荐它,因为它可能是跟踪无服务器基础架构(以及基础架构为代码=真棒)的最直接方式,您可以定义AWS :: Serverless :: Function为您在AWS :: Serverless :: Api中定义的每条路由分别设置一个单独的API网关源事件 。 如下所示: YourApi: Type: AWS::Serve ...
-
如下所述: 要为方法分配自定义访问权限,请在“授权设置”区域中为“授权类型”选择“编辑”,然后选择“AWS_IAM”。 只有附加了正确IAM策略的IAM角色才允许调用此方法。 然后,您只需要为Lambda函数分配适当的IAM角色,以允许它们调用这些私有API网关方法。 As documented here: To assign custom access permissions to the method, in the Authorization Settings area, for Authorizat ...
-
您可以使用Lambda函数侦听传入的Amazon SES消息。 然后阅读事件对象中的附件信息。 有了这个,您将拥有将所需的附件和其他数据发送到S3存储桶中的某个目录所需的内容。 然后,让S3存储桶在接收到第一个函数创建的文件时调用另一个Lambda函数(可以调用外部API)。 如果您需要更多信息,请告诉我们。 You can use a Lambda function to listen to incoming Amazon SES messages. Then read the attachment in ...