Month: July 2024
Looking for a way to find all instances of a single letter (variable) with spaces around. Wildcards?
For example, typing and a letter gets m isplaced. I would want to find where this happens, as the M is not picked up as a problem in spellcheck. I want to find any instances, of ANY letter, that has a space on either side of it. (even if it comes up with a lot of “I” entries.)
Is this possible, through wildcards or any other solution?
Thanks for your thoughts.
For example, typing and a letter gets m isplaced. I would want to find where this happens, as the M is not picked up as a problem in spellcheck. I want to find any instances, of ANY letter, that has a space on either side of it. (even if it comes up with a lot of “I” entries.) Is this possible, through wildcards or any other solution? Thanks for your thoughts. Read More
Debugger quits working in App Designer right after StartupFcn completes.
After a week of struggling with the Serial callback not working I undated to Update 8 of 2023b and that finally resolved. (I think)
MATLAB Version: 23.2.0.2599560 (R2023b) Update 8
Now (and before too but I had other problem to deal with) my program runs with AppDesigner but the debugger stops after StartupFcn completes. I can step to here:
% Construct app
function app = MouseOdor4
runningApp = getRunningApp(app);
"blah blah blah
if nargout == 0
clear app
end
end % last line where debugger is still running
The next step the debugger stops (my app is still running) and the editor pops up this with cursor as classdef but no marker for what line we are on.
classdef AppManagementService < handle
% APPMANAGEMENTSERVICE Singleton object to manage running apps
Any clues anyone? I’d like to get this project done!After a week of struggling with the Serial callback not working I undated to Update 8 of 2023b and that finally resolved. (I think)
MATLAB Version: 23.2.0.2599560 (R2023b) Update 8
Now (and before too but I had other problem to deal with) my program runs with AppDesigner but the debugger stops after StartupFcn completes. I can step to here:
% Construct app
function app = MouseOdor4
runningApp = getRunningApp(app);
"blah blah blah
if nargout == 0
clear app
end
end % last line where debugger is still running
The next step the debugger stops (my app is still running) and the editor pops up this with cursor as classdef but no marker for what line we are on.
classdef AppManagementService < handle
% APPMANAGEMENTSERVICE Singleton object to manage running apps
Any clues anyone? I’d like to get this project done! After a week of struggling with the Serial callback not working I undated to Update 8 of 2023b and that finally resolved. (I think)
MATLAB Version: 23.2.0.2599560 (R2023b) Update 8
Now (and before too but I had other problem to deal with) my program runs with AppDesigner but the debugger stops after StartupFcn completes. I can step to here:
% Construct app
function app = MouseOdor4
runningApp = getRunningApp(app);
"blah blah blah
if nargout == 0
clear app
end
end % last line where debugger is still running
The next step the debugger stops (my app is still running) and the editor pops up this with cursor as classdef but no marker for what line we are on.
classdef AppManagementService < handle
% APPMANAGEMENTSERVICE Singleton object to manage running apps
Any clues anyone? I’d like to get this project done! app designer debugger, crash MATLAB Answers — New Questions
SC VMM how to get VM console on Vmware hosts
I have imported some Vmware clusters into SC Virtual Machine Manager. I am running the most recent rollup of SC VMM 2019. The release notes claim that it supports up to VMware 8. My vcenter is 6.7 and my esxi cluster/hosts are 6.7. How can I get the console of a Vmware VM to work? From the VMM client, on the VM when I go to “Connect or view” -> “Connect via Console”. It tells me I need to install an active-x plugin.
That plugin doesnt exist because of course I’m running Vcenter 6.7 and ESXI 6.7 which don’t use active-x plugins. How do I attach to the console of a Vmware VM from SCVMM?
I have imported some Vmware clusters into SC Virtual Machine Manager. I am running the most recent rollup of SC VMM 2019. The release notes claim that it supports up to VMware 8. My vcenter is 6.7 and my esxi cluster/hosts are 6.7. How can I get the console of a Vmware VM to work? From the VMM client, on the VM when I go to “Connect or view” -> “Connect via Console”. It tells me I need to install an active-x plugin. That plugin doesnt exist because of course I’m running Vcenter 6.7 and ESXI 6.7 which don’t use active-x plugins. How do I attach to the console of a Vmware VM from SCVMM? Read More
Please fix edge update: An error occurred while checking for updates: 9 (error code 0). – macos
Please fix edge update: An error occurred while checking for updates: 9 (error code 0). – macos
There is no option to reset edge to new install
Please this is annoying, make me don’t want to use edge
Please fix edge update: An error occurred while checking for updates: 9 (error code 0). – macos There is no option to reset edge to new install Please this is annoying, make me don’t want to use edge Read More
Automatically updating “Calendar” when new data is added?
I need a way to automatically update the “Calendar View” worksheet (see example) with each new entry I add to the “Room Assignments & Dates” worksheet. Additionally, the “Calendar View” should somehow flag/highlight when there’s overlapping assignments, or, overbooked rooms. Presently, I have to manually add/edit each row in the “Calendar View”.
Additional info: Most rooms will allow for two people, so maybe I’d need to create room numbers that reflect that, e.g. Fake Room 201 holds two people, so maybe the room numbers needs to be 201-1 and 201-2, showing that there’s two beds in one room?…)
I need a way to automatically update the “Calendar View” worksheet (see example) with each new entry I add to the “Room Assignments & Dates” worksheet. Additionally, the “Calendar View” should somehow flag/highlight when there’s overlapping assignments, or, overbooked rooms. Presently, I have to manually add/edit each row in the “Calendar View”.Additional info: Most rooms will allow for two people, so maybe I’d need to create room numbers that reflect that, e.g. Fake Room 201 holds two people, so maybe the room numbers needs to be 201-1 and 201-2, showing that there’s two beds in one room?…) Read More
Using Azure Service Bus in Azure US Government
In our recent Azure Federal Developer Connect series, we covered connecting to Azure Service Bus using Azure Functions in Azure US Government. The process for connecting to Azure Service Bus doesn’t change much for the US Government cloud, but there are a couple of nuances I will call out here. This post will walk you through the code step by step, but if you’re in a hurry and just want to download the completed sample, the code is available here.
Azure Service Bus is a fully managed enterprise message broker with message queues and publish-subscribe topics. Service Bus is used to decouple applications and services from each other, providing the following benefits:
Load-balancing work across competing workers
Safely routing and transferring data and control across service and application boundaries
Coordinating transactional work that requires a high degree of reliability
What this means from a practical standpoint is that you will have some application which will publish messages to a queue or a topic, and one or many subscribing applications. Currently the Azure Service Bus client libraries support Python, C#, Java, and JavaScript, so the application communicating with Service Bus can take many forms, whether it’s a C# or Python web app hosted on an App Service, a JavaScript running in a Static Web App, a containerized Java application, a no-code/low-code solution like Logic Apps – literally any application hosting mechanism which can leverage the Azure Service Bus client libraries can be used to communicate with Azure Service Bus.
For this demo I chose to use Azure Functions running C#. C# is of course a popular language, and the Azure Functions runtime allows for a lightweight, scalable means of communicating with Service Bus. Furthermore, using the Azure Functions Core Tools, we can test the function without actually needing to deploy the functions into Azure, and we can debug from our local machine, even though Azure Service Bus is running in the cloud.
The publisher application is an Azure Function using the HttpTrigger, which will use the request body of the POST and send that message to a queue or topic. The subscriber applications are using the Service Bus triggers, a ServiceBusQueueTrigger and ServiceBusTopicTrigger to read from the queues and topics, respectively. These allow us to seamlessly connect with Service Bus and instantly pick up messages as they arrive on the Queue or Topic Subscription.
Running this demo
To run this demo, you will need the following components:
An Azure Subscription
Azure CLI
dotnet SDK 8
Azure Function Core Tools
Azurite storage emulator*
A code editor such as Visual Studio Code
A REST client testing tool such as Postman
*If you are using Visual Studio 2022, Azurite is available automatically. All steps described in this post can also be accomplished within Visual Studio, as well as Visual Studio code, or from the command line using any code editor of your choice.
Create the Azure Service Bus resource
Go into the Azure Portal and create a Service Bus resource. Azure Service Bus is available in three pricing tiers: Basic, Standard and Premium. For the purposes of this demo, we will want to create a Standard tier instance, as it will support Topics. You will need to pick a globally unique namespace, and you will want to make note of your fully qualified namespace in the form of servicebusnamespace.servicebus.usgovcloudapi.net. You can accept the defaults for the rest of the configuration.
Once your Service Bus resource is provisioned, go into the resource and select the “Access Control (IAM)” blade. Add your user to the Azure Service Bus Data Owner role, which will allow your user identity to read and write from the Service Bus. If you were to deploy the functions to Azure, you would create a managed identity for the Azure Function and assign it Azure Service Bus Data Owner, Azure Service Bus Data Reader, and/or Azure Service Bus Data Writer roles as appropriate. However, for the purposes of this demo we will be testing locally and will use your Azure credentials to authenticate to Service Bus.
Finally, find the Queue blade and create a queue (in the demo this is called ‘testq’ but you can name it whatever you’d like). Then find the Topic blade and create a new topic (‘testTopic’) and one or more subscriptions on the topic (‘testSubscription1′,’testSubscription2’, etc.).
Create the Azure Functions app locally
To build the scaffolding for the Azure Function Apps, we will use the Azure Function Core Tools to first initialize the Function App, then create the skeleton for the functions themselves.
Open a Windows Terminal session and change directories to where you’d like your code to reside. Enter the following command:
func init ServiceBusQueueFunc –worker-runtime dotnet-isolated –target-framework net8.0
Change directories to the “ServiceBusQueueFunc” directory (or whatever you called your function). Then add these functions:
func new –name ServiceBusQueueWriter –template “HTTP trigger”
func new –name ServiceBusQueueReader –template “ServiceBusQueueTrigger”
func new –name ServiceBusTopicReader –template “ServiceBusTopicTrigger”
And finally, we need to add two libraries which will add the Azure.Message.ServiceBus and Azure.Identity libraries so we can communicate with Service Bus.
dotnet add package Azure.Messaging.ServiceBus
dotnet add package Azure.Identity
Authentication to Service Bus
When it comes to authenticating with Azure Service Bus, we have a couple of choices. A simple way to authenticate is via a connection string, but this requires using a shared access key credential that you have to store and maintain somewhere, and which could be potentially compromised by a bad actor. To mitigate this, we can use the Azure.Identity library and use a managed identity for our function. Of course, because we’re testing locally, we do not have a managed identity, but the Azure.Identity library will also use our Azure CLI credentials to simulate one. To login to Azure CLI:
az cloud set –name AzureUSGovernment
az login –use-device-code #You may not need the use-device-code flag depending on your configuration
Configuring the Service Bus Writer Function
Now that we have the scaffolding of the Function App complete, it’s time to write a little code. If you open your code editor and open the ServiceBusQueueWriter.cs file, you’ll see the scaffolding code created by the Azure Functions Core Tools. As the Azure.Messaging.ServiceBus library uses Async methods, we will need to change the method to by async. Also, by default the function will accept both GET and POST requests, but as we’re reading from the request body, we will eliminate the GET.
public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, “post”)] HttpRequest req)
Next, we need to do is get the values for the Service Bus namespace and the name of the queue or topic we will be writing to. You can either hard code these values into your code, or retrieve them from your environment settings, e.g. a local.settings.json file.
string? fullyQualifiedNamespace = Environment.GetEnvironmentVariable(“ServiceBusConnection__fullyQualifiedNamespace”);
string? queueName = Environment.GetEnvironmentVariable(“ServiceBusQueueName”);
In the case of the ServiceBusConnection value, this will be the fully qualified namespace you gave your Service Bus resource, e.g. myservicebus.servicebus.usgovcloudapi.net.
Next, we’ll add a bit of code to parse the body of the HttpRequest so we can send this to the Service Bus queue or topic.
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
And finally, we will create the Service Bus client, create a sender attached to our queue or topic, and send the message. Note on lines 1 and 2 below, I am specifying that the AuthorityHost points at AzureGovernment. By default, the authentication will be attempted against Azure Commercial.
DefaultAzureCredentialOptions options = new DefaultAzureCredentialOptions();
options.AuthorityHost = AzureAuthorityHosts.AzureGovernment;
await using var client = new ServiceBusClient(fullyQualifiedNamespace, new DefaultAzureCredential(options));
var sender = client.CreateSender(queueName);
await sender.SendMessageAsync(new ServiceBusMessage(requestBody));
Configure the Service Bus Queue and Topic Reader Functions
To configure the Service Bus Queue and Topic Reader Functions is a bit simpler. To configure these, you simply need to add the queue/topic name and subscription (in the case of the Topic Reader) and the ServiceBusConnection.
There is a bit of a “gotcha” here. This value will be read in from your environment variables (e.g. local.settings.json) but utilizes a “magic” word in the configuration. For example, if you title your Connection “ServiceBusConnection”, the value in your environment variables needs to be:
“ServiceBusConnection__fullyQualifiedNamespace”: “myservicebus.servicebus.usgovcloudapi.net”,
For the Queue Reader:
public async Task Run(
[ServiceBusTrigger(“testq”, Connection = “ServiceBusConnection”)]
ServiceBusReceivedMessage message,
ServiceBusMessageActions messageActions)
For the Topic Reader:
public async Task Run(
[ServiceBusTrigger(“testTopic”, “testSubscription”, Connection = “ServiceBusConnection”)]
ServiceBusReceivedMessage message,
ServiceBusMessageActions messageActions)
Testing the Service Bus Queue Writer and Reader Functions
Open a new terminal window and start the Azurite storage emulator – this will run and stay persistent as long as this terminal window is open.
azurite
If you are using the command line only, you can now build the function app and start the local function run time with the following command:
func host start
If you are using Visual Studio Code, you can enter debug mode (which will support breakpoints in code) by selecting Run->Start Debugging.
When the function host starts, you should see the following:
If you are using Visual Studio Code, set a breakpoint in both the Writer and Queue Reader code. Opening your REST client tool (e.g. Postman), copy and paste the URL from the Writer function into a new POST request. In the request body, add some content into the body (you can add JSON, XML or plain text, just make sure the content-type header matches your text type).
At this point, you should be able to send your request. If you are in Visual Studio Code and have your breakpoints set, you should expect to see first the Writer function light up – go ahead and step through or hit F5 to let the code continue. If your send is successful, you should next expect to see the Queue Reader function light up. Because we are using a Service Bus trigger, the function will execute immediately when an item lands in the queue.
Testing the Topic Trigger
Writing to a topic does not require changing any code in the Queue Writer, we just need to change the destination from the name of the queue to the name of the topic. When you run your test again against the topic, this time we expect the Topic Reader function to execute. If you look at your topic and related subscriptions in the Azure portal, you should expect to see 0 messages in the subscription you are reading from, and 1 message each in the other subscriptions.
Conclusions
Hopefully this has been informative about how easy it is to implement messaging for your applications and solutions using Azure Service Bus, as well as highlighting the small nuances for using this feature in Azure Government. Future Service Bus topics may involve more advanced topics such as ordered message delivery and multi-region resiliency, but please suggest topics that you would like to see in a future post, and please bookmark Azure Federal Developer Connect and register for our upcoming sessions!
Microsoft Tech Community – Latest Blogs –Read More
Run simulink simulation in deployed app with from workspace block
Hi,
I am running Matlab 2023b. Now let me explain my situation:
I have an app that reads data with an external DLL. That works fine and the signals are stored in a variable called data.
The data variable looks like this:
In the model I use from workspace blocks like that:
After reading the data, I assign from the app to the base workspace so the simulink model can access it.
assignin(‘base’,’data’,app.data);
assignin(‘base’,’StopTime’,StopTime);
Afterwards I can run the simulation and provide the output to the app.
app.out = sim(‘LMDhDataCheck_Model’);
All of that works fine. Now to my problem. When I compile the app as standalone it does not read the input correctly.
I have tried already to precompile the model and then starting the exe, which does not work. It seems like the input is 0 all the time.
if isdeployed
% Code that gets run only by compiled applications
disp(‘Run deployed simulink sim’);
!LMDhDataCheck_Model;
load(‘LMDhDataCheck_Model.mat’);
vars = who();
TF = contains(vars, ‘rt_’);
varsFiltered = vars(TF);
for i = 1:length(varsFiltered)
app.out.(eraseBetween((varsFiltered{i,1}),1,3)) = eval((varsFiltered{i,1}));
end
else
% Code that gets run only in development environment
disp(‘Run development simulink sim’);
app.out = sim(‘LMDhDataCheck_Model’);
end
Then I tried to run the following code in the workspace before putting it in the app, but I get an error:
The tuned value of the variable ‘data’ (in the workspace ‘global-workspace’) has a different type than the variable’s default value.
in = Simulink.SimulationInput(‘LMDhDataCheck_Model’)
in = simulink.compiler.configureForDeployment(in)
in = setVariable(in, ‘data’, data)
in = setVariable(in, ‘StopTime’, StopTime)
out = sim(in)
Any help will be appriciated as I cannot find an answer in the forums.Hi,
I am running Matlab 2023b. Now let me explain my situation:
I have an app that reads data with an external DLL. That works fine and the signals are stored in a variable called data.
The data variable looks like this:
In the model I use from workspace blocks like that:
After reading the data, I assign from the app to the base workspace so the simulink model can access it.
assignin(‘base’,’data’,app.data);
assignin(‘base’,’StopTime’,StopTime);
Afterwards I can run the simulation and provide the output to the app.
app.out = sim(‘LMDhDataCheck_Model’);
All of that works fine. Now to my problem. When I compile the app as standalone it does not read the input correctly.
I have tried already to precompile the model and then starting the exe, which does not work. It seems like the input is 0 all the time.
if isdeployed
% Code that gets run only by compiled applications
disp(‘Run deployed simulink sim’);
!LMDhDataCheck_Model;
load(‘LMDhDataCheck_Model.mat’);
vars = who();
TF = contains(vars, ‘rt_’);
varsFiltered = vars(TF);
for i = 1:length(varsFiltered)
app.out.(eraseBetween((varsFiltered{i,1}),1,3)) = eval((varsFiltered{i,1}));
end
else
% Code that gets run only in development environment
disp(‘Run development simulink sim’);
app.out = sim(‘LMDhDataCheck_Model’);
end
Then I tried to run the following code in the workspace before putting it in the app, but I get an error:
The tuned value of the variable ‘data’ (in the workspace ‘global-workspace’) has a different type than the variable’s default value.
in = Simulink.SimulationInput(‘LMDhDataCheck_Model’)
in = simulink.compiler.configureForDeployment(in)
in = setVariable(in, ‘data’, data)
in = setVariable(in, ‘StopTime’, StopTime)
out = sim(in)
Any help will be appriciated as I cannot find an answer in the forums. Hi,
I am running Matlab 2023b. Now let me explain my situation:
I have an app that reads data with an external DLL. That works fine and the signals are stored in a variable called data.
The data variable looks like this:
In the model I use from workspace blocks like that:
After reading the data, I assign from the app to the base workspace so the simulink model can access it.
assignin(‘base’,’data’,app.data);
assignin(‘base’,’StopTime’,StopTime);
Afterwards I can run the simulation and provide the output to the app.
app.out = sim(‘LMDhDataCheck_Model’);
All of that works fine. Now to my problem. When I compile the app as standalone it does not read the input correctly.
I have tried already to precompile the model and then starting the exe, which does not work. It seems like the input is 0 all the time.
if isdeployed
% Code that gets run only by compiled applications
disp(‘Run deployed simulink sim’);
!LMDhDataCheck_Model;
load(‘LMDhDataCheck_Model.mat’);
vars = who();
TF = contains(vars, ‘rt_’);
varsFiltered = vars(TF);
for i = 1:length(varsFiltered)
app.out.(eraseBetween((varsFiltered{i,1}),1,3)) = eval((varsFiltered{i,1}));
end
else
% Code that gets run only in development environment
disp(‘Run development simulink sim’);
app.out = sim(‘LMDhDataCheck_Model’);
end
Then I tried to run the following code in the workspace before putting it in the app, but I get an error:
The tuned value of the variable ‘data’ (in the workspace ‘global-workspace’) has a different type than the variable’s default value.
in = Simulink.SimulationInput(‘LMDhDataCheck_Model’)
in = simulink.compiler.configureForDeployment(in)
in = setVariable(in, ‘data’, data)
in = setVariable(in, ‘StopTime’, StopTime)
out = sim(in)
Any help will be appriciated as I cannot find an answer in the forums. appdesigner, simulink, standalone MATLAB Answers — New Questions
Connecting to a serial port in App Designer
Hello,
I want to connect to a serial port using App Designer, I know how to just use it over the command line but in App Designer I am not sure how to do two things, first how do I connect to the device at once rather than connecting to the device everytime I press a button, second I want to define a variable "rel" through which I can define how much the piezo stage can move. But for the error that I am getting is
Reference to non-existent field ‘rel’.
Error in app1/upButtonPushed (line 29)
temp=app.rel.Value
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.
The code fo the APP designer is:
classdef app1 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
up matlab.ui.control.Button
left matlab.ui.control.Button
right matlab.ui.control.Button
down matlab.ui.control.Button
relEditFieldLabel matlab.ui.control.Label
rel matlab.ui.control.NumericEditField
end
properties (Access = public)
s % Description
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: up
function upButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
temp=app.rel.Value
writeline(app.s, sprintf(‘2MVR%d’,temp));
%writeline(app.s, ‘2MVR-2’);
%data=readline(s)
end
% Button pushed function: left
function leftButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
writeline(app.s, ‘1MVR2’);
end
% Button pushed function: right
function rightButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
writeline(app.s, ‘1MVR-2’);
end
% Button pushed function: down
function downButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
writeline(app.s, ‘2MVR2’);
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure(‘Visible’, ‘off’);
app.UIFigure.Position = [100 100 319 165];
app.UIFigure.Name = ‘UI Figure’;
% Create up
app.up = uibutton(app.UIFigure, ‘push’);
app.up.ButtonPushedFcn = createCallbackFcn(app, @upButtonPushed, true);
app.up.Icon = ‘icons8-collapse-arrow-48.png’;
app.up.Position = [73 115 39 22];
app.up.Text = ”;
% Create left
app.left = uibutton(app.UIFigure, ‘push’);
app.left.ButtonPushedFcn = createCallbackFcn(app, @leftButtonPushed, true);
app.left.Icon = ‘icons8-back-48.png’;
app.left.Position = [18 71 39 22];
app.left.Text = ”;
% Create right
app.right = uibutton(app.UIFigure, ‘push’);
app.right.ButtonPushedFcn = createCallbackFcn(app, @rightButtonPushed, true);
app.right.Icon = ‘icons8-forward-48.png’;
app.right.Position = [128 71 39 22];
app.right.Text = ”;
% Create down
app.down = uibutton(app.UIFigure, ‘push’);
app.down.ButtonPushedFcn = createCallbackFcn(app, @downButtonPushed, true);
app.down.Icon = ‘icons8-expand-arrow-48.png’;
app.down.Position = [73 31 39 22];
app.down.Text = ”;
% Create relEditFieldLabel
app.relEditFieldLabel = uilabel(app.UIFigure);
app.relEditFieldLabel.HorizontalAlignment = ‘right’;
app.relEditFieldLabel.Position = [158 125 25 22];
app.relEditFieldLabel.Text = ‘rel’;
% Create rel
app.rel = uieditfield(app.UIFigure, ‘numeric’);
app.rel.Position = [198 125 100 22];
app.rel.Value = -2;
% Show the figure after all components are created
app.UIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = app1
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
endHello,
I want to connect to a serial port using App Designer, I know how to just use it over the command line but in App Designer I am not sure how to do two things, first how do I connect to the device at once rather than connecting to the device everytime I press a button, second I want to define a variable "rel" through which I can define how much the piezo stage can move. But for the error that I am getting is
Reference to non-existent field ‘rel’.
Error in app1/upButtonPushed (line 29)
temp=app.rel.Value
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.
The code fo the APP designer is:
classdef app1 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
up matlab.ui.control.Button
left matlab.ui.control.Button
right matlab.ui.control.Button
down matlab.ui.control.Button
relEditFieldLabel matlab.ui.control.Label
rel matlab.ui.control.NumericEditField
end
properties (Access = public)
s % Description
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: up
function upButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
temp=app.rel.Value
writeline(app.s, sprintf(‘2MVR%d’,temp));
%writeline(app.s, ‘2MVR-2’);
%data=readline(s)
end
% Button pushed function: left
function leftButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
writeline(app.s, ‘1MVR2’);
end
% Button pushed function: right
function rightButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
writeline(app.s, ‘1MVR-2’);
end
% Button pushed function: down
function downButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
writeline(app.s, ‘2MVR2’);
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure(‘Visible’, ‘off’);
app.UIFigure.Position = [100 100 319 165];
app.UIFigure.Name = ‘UI Figure’;
% Create up
app.up = uibutton(app.UIFigure, ‘push’);
app.up.ButtonPushedFcn = createCallbackFcn(app, @upButtonPushed, true);
app.up.Icon = ‘icons8-collapse-arrow-48.png’;
app.up.Position = [73 115 39 22];
app.up.Text = ”;
% Create left
app.left = uibutton(app.UIFigure, ‘push’);
app.left.ButtonPushedFcn = createCallbackFcn(app, @leftButtonPushed, true);
app.left.Icon = ‘icons8-back-48.png’;
app.left.Position = [18 71 39 22];
app.left.Text = ”;
% Create right
app.right = uibutton(app.UIFigure, ‘push’);
app.right.ButtonPushedFcn = createCallbackFcn(app, @rightButtonPushed, true);
app.right.Icon = ‘icons8-forward-48.png’;
app.right.Position = [128 71 39 22];
app.right.Text = ”;
% Create down
app.down = uibutton(app.UIFigure, ‘push’);
app.down.ButtonPushedFcn = createCallbackFcn(app, @downButtonPushed, true);
app.down.Icon = ‘icons8-expand-arrow-48.png’;
app.down.Position = [73 31 39 22];
app.down.Text = ”;
% Create relEditFieldLabel
app.relEditFieldLabel = uilabel(app.UIFigure);
app.relEditFieldLabel.HorizontalAlignment = ‘right’;
app.relEditFieldLabel.Position = [158 125 25 22];
app.relEditFieldLabel.Text = ‘rel’;
% Create rel
app.rel = uieditfield(app.UIFigure, ‘numeric’);
app.rel.Position = [198 125 100 22];
app.rel.Value = -2;
% Show the figure after all components are created
app.UIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = app1
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end Hello,
I want to connect to a serial port using App Designer, I know how to just use it over the command line but in App Designer I am not sure how to do two things, first how do I connect to the device at once rather than connecting to the device everytime I press a button, second I want to define a variable "rel" through which I can define how much the piezo stage can move. But for the error that I am getting is
Reference to non-existent field ‘rel’.
Error in app1/upButtonPushed (line 29)
temp=app.rel.Value
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.
The code fo the APP designer is:
classdef app1 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
up matlab.ui.control.Button
left matlab.ui.control.Button
right matlab.ui.control.Button
down matlab.ui.control.Button
relEditFieldLabel matlab.ui.control.Label
rel matlab.ui.control.NumericEditField
end
properties (Access = public)
s % Description
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: up
function upButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
temp=app.rel.Value
writeline(app.s, sprintf(‘2MVR%d’,temp));
%writeline(app.s, ‘2MVR-2’);
%data=readline(s)
end
% Button pushed function: left
function leftButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
writeline(app.s, ‘1MVR2’);
end
% Button pushed function: right
function rightButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
writeline(app.s, ‘1MVR-2’);
end
% Button pushed function: down
function downButtonPushed(app, event)
clear all
app.s = serialport("COM5",38400);
configureTerminator(app.s,"CR")
writeline(app.s, ‘2MVR2’);
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure(‘Visible’, ‘off’);
app.UIFigure.Position = [100 100 319 165];
app.UIFigure.Name = ‘UI Figure’;
% Create up
app.up = uibutton(app.UIFigure, ‘push’);
app.up.ButtonPushedFcn = createCallbackFcn(app, @upButtonPushed, true);
app.up.Icon = ‘icons8-collapse-arrow-48.png’;
app.up.Position = [73 115 39 22];
app.up.Text = ”;
% Create left
app.left = uibutton(app.UIFigure, ‘push’);
app.left.ButtonPushedFcn = createCallbackFcn(app, @leftButtonPushed, true);
app.left.Icon = ‘icons8-back-48.png’;
app.left.Position = [18 71 39 22];
app.left.Text = ”;
% Create right
app.right = uibutton(app.UIFigure, ‘push’);
app.right.ButtonPushedFcn = createCallbackFcn(app, @rightButtonPushed, true);
app.right.Icon = ‘icons8-forward-48.png’;
app.right.Position = [128 71 39 22];
app.right.Text = ”;
% Create down
app.down = uibutton(app.UIFigure, ‘push’);
app.down.ButtonPushedFcn = createCallbackFcn(app, @downButtonPushed, true);
app.down.Icon = ‘icons8-expand-arrow-48.png’;
app.down.Position = [73 31 39 22];
app.down.Text = ”;
% Create relEditFieldLabel
app.relEditFieldLabel = uilabel(app.UIFigure);
app.relEditFieldLabel.HorizontalAlignment = ‘right’;
app.relEditFieldLabel.Position = [158 125 25 22];
app.relEditFieldLabel.Text = ‘rel’;
% Create rel
app.rel = uieditfield(app.UIFigure, ‘numeric’);
app.rel.Position = [198 125 100 22];
app.rel.Value = -2;
% Show the figure after all components are created
app.UIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = app1
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end app designer MATLAB Answers — New Questions
Missing Instruction/Error in Automation Script
Hi all,
I’m sure this is going to be some basic thing, but I am getting an error when my automation script runs, specifically this portion below. What is missing or not formatted correctly? It is intended to apply a conditional rule across column A that uses function RIGHT to find any number ending in 2 or 7 and apply custom formatting.
Please let me know what other info is needed if any, thank you in advance!
// Create custom from range A:A on selectedSheet
conditionalFormatting = selectedSheet.getRange(“A:A”).addConditionalFormat(ExcelScript.ConditionalFormatType.custom);
conditionalFormatting.getCustom().getRule().setFormula(“=OR(RIGHT(A1,1)=””2″”,RIGHT(A1,1)=””7″”)”);
conditionalFormatting.getCustom().getFormat().getFill().setColor(“#92d050”);
conditionalFormatting.getCustom().getFormat().getFont().setBold(true);
conditionalFormatting.getCustom().getFormat().getFont().setItalic(false);
conditionalFormatting.setStopIfTrue(false);
conditionalFormatting.setPriority(0);
}
Hi all, I’m sure this is going to be some basic thing, but I am getting an error when my automation script runs, specifically this portion below. What is missing or not formatted correctly? It is intended to apply a conditional rule across column A that uses function RIGHT to find any number ending in 2 or 7 and apply custom formatting. Please let me know what other info is needed if any, thank you in advance! // Create custom from range A:A on selectedSheet
conditionalFormatting = selectedSheet.getRange(“A:A”).addConditionalFormat(ExcelScript.ConditionalFormatType.custom);
conditionalFormatting.getCustom().getRule().setFormula(“=OR(RIGHT(A1,1)=””2″”,RIGHT(A1,1)=””7″”)”);
conditionalFormatting.getCustom().getFormat().getFill().setColor(“#92d050”);
conditionalFormatting.getCustom().getFormat().getFont().setBold(true);
conditionalFormatting.getCustom().getFormat().getFont().setItalic(false);
conditionalFormatting.setStopIfTrue(false);
conditionalFormatting.setPriority(0);
} Read More
Found 2 OneDrive repositories on my MacBook Pro – Safe to delete one?
I have a MacBook Pro M1 Max with a 1TB SSD, and it’s starting to get full. I ran a disk space analyzer to get an idea of what I could delete. I found what appears to be two OneDrive repositories on my local SSD and want to know if it’s safe to delete one, and if so, which one. I have three different OneDrive accounts (Personal, Business, Client).
In /Users/{my name}/Library/CloudStorage are three folders with the OneDrive icon in place of the standard Apple folder icon. They all of “Last Modified” dates of yesterday. I assume these are my current files.
But I also found three hidden folders in /Users/{my name}/Library/Group Containers/UBF8T3XXXX.OneDriveStandaloneSuite/OneDrive – {accountname}.noindex. The three of them show “Last Modified” dates from 2021,2022, and 2023 respectively. Together they take up 38GBs worth of space. Are these remnants of an old version of OneDrive or something like that? Can I delete them to reclaim the space?
I’m hesitant to touch them because as a test I created a new folder name ‘zzzzz’ in the OneDrive folder that opens when the OneDrive icon in Finder’s sidebar is clicked. The new folder is created in both folders (the one under ‘Group Contains’ and the one under ‘CloudStorage.’ Do I have two instances of OneDrive running, each updating a different local repository?
Any insight into the situation would be great. Thanks!
I have a MacBook Pro M1 Max with a 1TB SSD, and it’s starting to get full. I ran a disk space analyzer to get an idea of what I could delete. I found what appears to be two OneDrive repositories on my local SSD and want to know if it’s safe to delete one, and if so, which one. I have three different OneDrive accounts (Personal, Business, Client). In /Users/{my name}/Library/CloudStorage are three folders with the OneDrive icon in place of the standard Apple folder icon. They all of “Last Modified” dates of yesterday. I assume these are my current files. But I also found three hidden folders in /Users/{my name}/Library/Group Containers/UBF8T3XXXX.OneDriveStandaloneSuite/OneDrive – {accountname}.noindex. The three of them show “Last Modified” dates from 2021,2022, and 2023 respectively. Together they take up 38GBs worth of space. Are these remnants of an old version of OneDrive or something like that? Can I delete them to reclaim the space? I’m hesitant to touch them because as a test I created a new folder name ‘zzzzz’ in the OneDrive folder that opens when the OneDrive icon in Finder’s sidebar is clicked. The new folder is created in both folders (the one under ‘Group Contains’ and the one under ‘CloudStorage.’ Do I have two instances of OneDrive running, each updating a different local repository? Any insight into the situation would be great. Thanks! Read More
What is the eligible license that need to be assigned to each user account for RDS/shared computer ?
Can we have business standard license assigned to the user. The Article link does not point to the eligble license list and need more accuracy.
One of the following plans:A Microsoft 365 (or Office 365) plan that includes Microsoft 365 Apps for enterprise.A Microsoft 365 Business Premium plan that includes Microsoft 365 Apps for business.For the Project and Visio desktop apps, a subscription plan that includes those products.The Office Deployment Tool, which is available on the Microsoft Download Center.A separate user account for each user who signs in to the shared computer.An eligible license assigned to each user account.
Can we have business standard license assigned to the user. The Article link does not point to the eligble license list and need more accuracy. https://learn.microsoft.com/en-us/microsoft-365-apps/deploy/deploy-microsoft-365-apps-remote-desktop-services#what-you-need-to-get-started One of the following plans:A Microsoft 365 (or Office 365) plan that includes Microsoft 365 Apps for enterprise.A Microsoft 365 Business Premium plan that includes Microsoft 365 Apps for business.For the Project and Visio desktop apps, a subscription plan that includes those products.The Office Deployment Tool, which is available on the Microsoft Download Center.A separate user account for each user who signs in to the shared computer.An eligible license assigned to each user account. Read More
Planner _ display on Galaxy fold mobile
Dear community
Do you know if possible to display several columns of planner or zoom in / zoom out in planner on the wide screen of a Galaxy Zfold 5 or 6 smartphone, and how to configure ?
Many thanks in advance.
Dear communityDo you know if possible to display several columns of planner or zoom in / zoom out in planner on the wide screen of a Galaxy Zfold 5 or 6 smartphone, and how to configure ?Many thanks in advance. Read More
How to calculate semiMajorAxis and trueAnomaly from TLE file
Hi,
I am trying to add satelltie to satellite scenario by following the documentaion.
The general way is to simply use the TLE file
sat1 = satellite(sc,tleFile,"Name","Sat1")
If I want to find the Keplerian elements the function orbitalElements(sat1) can give eccentricity, inclination, rightAscensionOfAscendingNode and argumentOfPeriapsis. But how does MATLAB computes semiMajorAxis and trueAnomaly?
Any help is appreicated.
Thank youHi,
I am trying to add satelltie to satellite scenario by following the documentaion.
The general way is to simply use the TLE file
sat1 = satellite(sc,tleFile,"Name","Sat1")
If I want to find the Keplerian elements the function orbitalElements(sat1) can give eccentricity, inclination, rightAscensionOfAscendingNode and argumentOfPeriapsis. But how does MATLAB computes semiMajorAxis and trueAnomaly?
Any help is appreicated.
Thank you Hi,
I am trying to add satelltie to satellite scenario by following the documentaion.
The general way is to simply use the TLE file
sat1 = satellite(sc,tleFile,"Name","Sat1")
If I want to find the Keplerian elements the function orbitalElements(sat1) can give eccentricity, inclination, rightAscensionOfAscendingNode and argumentOfPeriapsis. But how does MATLAB computes semiMajorAxis and trueAnomaly?
Any help is appreicated.
Thank you matlab, communication MATLAB Answers — New Questions
online tools for classification learner
I’m doing the online course of machine learning with MATLAB but in some cases when i try to run the classification learner automatically MATLAB’S session turn off. I can’t to continue because in the activity "Improving Predictive ModelsHyperparameter Optimization(4/4) Optimize Hyperparameters in Classification Learner" , in activity three matlab send a message 🙁 MATLAB found a problem and close the activity).I’m doing the online course of machine learning with MATLAB but in some cases when i try to run the classification learner automatically MATLAB’S session turn off. I can’t to continue because in the activity "Improving Predictive ModelsHyperparameter Optimization(4/4) Optimize Hyperparameters in Classification Learner" , in activity three matlab send a message 🙁 MATLAB found a problem and close the activity). I’m doing the online course of machine learning with MATLAB but in some cases when i try to run the classification learner automatically MATLAB’S session turn off. I can’t to continue because in the activity "Improving Predictive ModelsHyperparameter Optimization(4/4) Optimize Hyperparameters in Classification Learner" , in activity three matlab send a message 🙁 MATLAB found a problem and close the activity). matlab encountered a problem MATLAB Answers — New Questions
How to load input data to Fuzzy logic designer to validate the system
I’ve designed a fuzzy inference system using the fuzzy logic designer app. I now want to validate the deisgn with a dataset but do not know how to create or load a file into fuzzy logic designer.
I managed to get a data file into the workspace but when I try to select the data it cannot be seen in the worksapce.
Some guidance on how to create input data files and load them for simualtion would be helpful – thanks.I’ve designed a fuzzy inference system using the fuzzy logic designer app. I now want to validate the deisgn with a dataset but do not know how to create or load a file into fuzzy logic designer.
I managed to get a data file into the workspace but when I try to select the data it cannot be seen in the worksapce.
Some guidance on how to create input data files and load them for simualtion would be helpful – thanks. I’ve designed a fuzzy inference system using the fuzzy logic designer app. I now want to validate the deisgn with a dataset but do not know how to create or load a file into fuzzy logic designer.
I managed to get a data file into the workspace but when I try to select the data it cannot be seen in the worksapce.
Some guidance on how to create input data files and load them for simualtion would be helpful – thanks. fuzzy logic designer app, system vailidation, input data MATLAB Answers — New Questions
Best way to set up computers for new employees in small office
We are a small office of 2 (soon will be 3) employees. We recently purchased a new computer to replace the one I have been using. I’m trying to figure out the best way to set up my computer and the computer for the new employee. My supervisor currently has Office 2021 Home and Student installed on her computer. I was going to install the same thing on my new computer. But I’ve also been asked to install something on the computer for the new employee as well. If I use my Microsoft account to install Office 2021 Home/Student on my computer – how do I go about setting up the new computer? I don’t know that I can be logged in and purchase Office 2021 Home/Student under my Microsoft account, can I? Once I purchase it, doesn’t the license go with the account that was logged in to purchase it? We also talked about just creating a generic Microsoft account – like “help” or “tech” or something. But then we would have to sign in to Microsoft using that account and all the purchases would be under that account.
What’s the best practice here? What’s the best way to set up my computer and the computer for the new employee? What have you found that works and what doesn’t work?
Thanks!
We are a small office of 2 (soon will be 3) employees. We recently purchased a new computer to replace the one I have been using. I’m trying to figure out the best way to set up my computer and the computer for the new employee. My supervisor currently has Office 2021 Home and Student installed on her computer. I was going to install the same thing on my new computer. But I’ve also been asked to install something on the computer for the new employee as well. If I use my Microsoft account to install Office 2021 Home/Student on my computer – how do I go about setting up the new computer? I don’t know that I can be logged in and purchase Office 2021 Home/Student under my Microsoft account, can I? Once I purchase it, doesn’t the license go with the account that was logged in to purchase it? We also talked about just creating a generic Microsoft account – like “help” or “tech” or something. But then we would have to sign in to Microsoft using that account and all the purchases would be under that account. What’s the best practice here? What’s the best way to set up my computer and the computer for the new employee? What have you found that works and what doesn’t work? Thanks! Read More
Schedule Times Not correct In Bookings
Hi there. I’m trying to get Bookings setup for my rented venue, and despite me setting the “Business Hours” to open at 9am, I am still shown 4am in the available booking times…
Hi there. I’m trying to get Bookings setup for my rented venue, and despite me setting the “Business Hours” to open at 9am, I am still shown 4am in the available booking times…Public Bookings PageBusiness HoursService Availability Hours Read More
Does Intune create a new user profile?
Hello,
I am new to Intune and figuring out a way to enroll our corporate devices (i.e. Windows and Mac devices) to Intune. Currently, we are using a third-party device management tool and planning to move to Intune soon. My question is about the user profiles. Our users already have a profile on their laptops and all their data, files is in those profiles. If we enroll the devices to Intune, is it going to create a new user profile for them? If that’s the case, it adds another challenge to move the user data from old profile to new one. We have around 200+ users so this will require a lot of work from admin side.
Any advice is appreciated.
Hello, I am new to Intune and figuring out a way to enroll our corporate devices (i.e. Windows and Mac devices) to Intune. Currently, we are using a third-party device management tool and planning to move to Intune soon. My question is about the user profiles. Our users already have a profile on their laptops and all their data, files is in those profiles. If we enroll the devices to Intune, is it going to create a new user profile for them? If that’s the case, it adds another challenge to move the user data from old profile to new one. We have around 200+ users so this will require a lot of work from admin side. Any advice is appreciated. Read More
Unable to setup Microsoft Global Secure Access
Firstly I am not getting any login prompt to login to the GSA client on any of my devices and when I navigate thru to the advanced diagnostics area and the health check area I get : ( I dont belive i am logged in )
Im not very sure if I’ve set it up correctly so an input on this would be much appreciated
Thanks, Rhythm
Firstly I am not getting any login prompt to login to the GSA client on any of my devices and when I navigate thru to the advanced diagnostics area and the health check area I get : ( I dont belive i am logged in ) Im not very sure if I’ve set it up correctly so an input on this would be much appreciated Thanks, Rhythm Read More
Forgot Excel File ‘Protection Password’
Hi, my name is Johnson M, and I’m from India.
I use Microsoft 365 licensed version and have stored very important details in an Excel file that is updated monthly.
In mid-May, I changed the file password, thinking I’d remember it, but I can’t recall it despite trying all possible methods.
I’ve spent over a month trying to recover the password, using various online tips and videos but nothing has worked.
I am not sure of the time taken by brute force method used by professional data recovery tools and whether any tools can recover the password from Microsoft 365 version of the Excel application.
I regret not reaching out to this community sooner. Can you please help me?
Thank you so much!
Hi, my name is Johnson M, and I’m from India.I use Microsoft 365 licensed version and have stored very important details in an Excel file that is updated monthly.In mid-May, I changed the file password, thinking I’d remember it, but I can’t recall it despite trying all possible methods.I’ve spent over a month trying to recover the password, using various online tips and videos but nothing has worked.I am not sure of the time taken by brute force method used by professional data recovery tools and whether any tools can recover the password from Microsoft 365 version of the Excel application.I regret not reaching out to this community sooner. Can you please help me?Thank you so much! Read More