Why do I receive the error message "MATLAB:COM:server creation failed" when trying to communicate with a COM server using MATLAB?

When trying to communicate with a third party application using the COM server in MATLAB, I am receiving the following error message,
try
app = actxserver('STK11.application');
app.Visible = 1;
disp('success!');
catch ME
disp('error:');
disp(ME.message);
end

Answers (1)

I didn't recognize what STK11 would be so asked AI...it says it ANSYS and it looks like a primary likely cause may be a licensing or installation issue, and not MATLAB related. The 'bot's reply follows (cleaned up some for posting)...
When attempting to create a COM server connection to Ansys STK (Systems Tool Kit) using actxserver('STK11.application'), the "Server creation failed" error narrows down to three primary STK-specific issues: unregistered integration libraries, missing external connectivity licensing, or version mismatches.
1. Unregistered STK COM Classes (Most Common)
If STK 11 was installed without full administrative privileges, its unique programmatic identifiers (ProgID) will not be recorded in your Windows Registry.
  • The Fix: You must manually run the STK Registration Utility as an Administrator.
  1. Close MATLAB.
  2. Navigate to your STK install path (typically C:\Program Files\AGI\STK 11\bin\).
  3. Right-click AgUiRegistrationUtil.exe and select Run as Administrator.
  4. Click Register All and wait for the confirmation window.
  5. Reopen MATLAB and retry the command. [1]
2. Missing "External Connectivity" License
STK requires an explicit licensing seat or add-on token to allow third-party programs (like MATLAB or Python) to control its engine. Even if you can open the STK GUI manually, your license might block COM API calls.
  • The Fix: Check your active licensing profile.
  1. Open the STK License Manager.
  2. Ensure that your current license contains the STK Integration module or MATLAB Connector token.
  3. Note: If you are utilizing a university network or floating license, this token may be fully checked out by other concurrent users on the network.
3. Explicit Version-String Mismatch
If you have multiple versions of STK installed (e.g., STK 11 and STK 12), Windows can lose track of the generic identifier. Furthermore, STK11.application is case-sensitive on some older configuration environments.
  • The Fix: Try varying your exact string structure within the actxserver function to see if the registry catches an alternative path:matlab% Try alternative casing
app = actxserver('STK11.Application');
% Try the generic target mapping to see if it defaults to your active version
app = actxserver('STK.Application');
To rule out MATLAB entirely, isolate the issue inside Windows itself. Close MATLAB, open Windows PowerShell, and execute this line:
$stk = New-Object -ComObject STK11.Application
  • If PowerShell fails with an error: The issue belongs entirely to STK's local installation, registration, or licensing.
  • If PowerShell succeeds without an error: The issue is a local MATLAB permissions or environment block.
What specific error code or sub-description pops up alongside the failure message (e.g., "Access is Denied", "Class not registered", or "Server execution failed")?

7 Comments

Hello, here is the screenshot after I ran the command $stk = New-Object -ComObject STK11.Application in Windows PowerShell.
Previously, I was able to invoke STK 11 through the COM interface using MATLAB scripts successfully. Unfortunately, this problem occurred when I executed the script yesterday. I have exhausted all relevant troubleshooting methods I could locate, but the issue persists. Therefore, I am reaching out to consult you regarding possible underlying causes of this failure.
The PowerShell failure proves the issue is not MATLAB related but most likely in the ANSYS STK registry registration/permissions having been corrupted/changed/lost by an update or the like. The AI 'bot's best guesses follow --
Since you isolated the issue away from MATLAB via PowerShell, it proves the Windows OS Registry completely lost its mapping for STK 11's ActiveX/COM classes. MATLAB uses actxserver('STK11.Application') under the hood, which queries the exact same registry keys that just failed in PowerShell.
Because it was working before, a recent software update, security patch, or user-profile change wiped the relevant CLSID (Class ID) records.
Execute these precise registry-repair steps on the machine:
1. Run the STK 11 Internal Re-Registration Utility
This is the fastest fix. STK includes a specific executable built to re-write missing ActiveX/COM parameters directly into the Windows Registry.
  1. Open Windows File Explorer and navigate to the STK bin folder:
  • 64-bit STK: C:\Program Files\AGI\STK 11\bin\
  • 32-bit STK: C:\Program Files (x86)\AGI\STK 11\bin\
  1. Locate the file AgPluginReg.exe.
  2. Right-click it and select Run as Administrator. A black command window will flash and close—this forces STK to rebuild its broken ActiveX pathways. [1]
2. Isolate the Version-Specific ProgID
  • Test the generic fallback engine:
At the command line execute
matlabstkApp = actxserver('AgStkObjects11.AgStkObjectRoot');
  • Note: If the above line works but 'STK11.Application' failed, it confirms AgPluginReg.exe needs to be rerun as an Admin to restore the primary STK11.Application shortcut.
3. Check for User vs. Administrator Token Mismatches
If MATLAB is running with standard user privileges, but STK 11 was recently opened, updated, or installed as an Administrator, Windows will block the ActiveX handshake via User Account Control (UAC).
  • The Fix: Ensure both MATLAB and STK are running under the exact same privilege level. Completely close both programs, right-click the MATLAB icon, select Run as Administrator, and attempt the code again.
If none of the above lead to joy, I think you'll have to contact ANSYS support; it isn't a MATLAB problem.
Would be interest and perhaps of benefit to others later to post what turns out to be the final resolution as there is a fair smattering of queries regarding ANSYS on the forum.
Good luck...
Hi, regrettably I was unable to resolve the underlying error directly. Windows Event Viewer logged a DCOM registration timeout failure. Lacking expertise in DCOM configuration, I opted to fully remove STK 11 and perform a fresh installation of STK 12. The script executes successfully under STK 12, which is my workaround for this fault.
Undoubtedly an expedient fix over trying to repair a corrputed registry entry.
Glad to hear you got it resolved and that will be a useful result for anybody else experiencing similar/same issue that finds this thread.

Sign in to comment.

Tags

Asked:

on 2 Jul 2026

Commented:

dpb
on 4 Jul 2026

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!