Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8376721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:29:32+00:00 2026-06-09T15:29:32+00:00

I have problem. I don’t know what is the code to call Matlab by

  • 0

I have problem. I don’t know what is the code to call Matlab by using VBA excel.

I tried using

matlabinit

But after I run it, it doesn’t work and there was an error message "sub or function not defined“

ouh guys, i have this code, but i cannot run it.

Sub jadwal()
'*************************************************************
'Unprotect sheets
'*************************************************************
Sheets("Hasil_jadwal_baru").Select
ActiveSheet.Unprotect
'*************************************************************
'Clear the previous schedule
'*************************************************************
Sheets("Hasil_jadwal_baru").Select
Range("A1:CG14").Select
Selection.ClearContents
'*************************************************************
'Clear the previous variable in MATLAB and set up the application
'*************************************************************

Application.DisplayAlerts = False
Application.Run "matlabinit"
MLEvalString "clear;"
MLEvalString "clc;"
'*************************************************************
'Send input to MATLAB
'*************************************************************
MLPutMatrix "ic_april", Range("ic_april")
MLPutMatrix "ic_juni", Range("ic_juni")
MLPutMatrix "ic_sept", Range("ic_sept")
MLPutMatrix "ic_libur_april", Range("ic_libur_april")
MLPutMatrix "ic_libur_juni", Range("ic_libur_juni")
MLPutMatrix "ic_libur_sept", Range("ic_libur_sept")
'*************************************************************
'Solve the problem via MATLAB and LP-SOLVE
'*************************************************************
MLEvalString "fixuntukmin"
'*************************************************************
'Send the result to EXCEL
'*************************************************************
MLGetMatrix "hasil_jadwal", "Hasil_jadwal_baru"
MatlabRequest
'*************************************************************
'Close MATLAB
'*************************************************************
MLClose
MLAutoStart "no"
Application.DisplayAlerts = True

'*************************************************************
'Finish Alarm
'*************************************************************

'*************************************************************
'Reprotect sheets
'*************************************************************
Sheets("Hasil_jadwal_baru").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
        , AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True

End Sub

can you help me??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:29:33+00:00Added an answer on June 9, 2026 at 3:29 pm

    It sounds like you just need to add a reference to Spreadsheet link EX in your VBA code. Select tools -> references and then tick the spreadsheet link EX library. After that it should work.

    Alternately you can call addin functions without adding references using application.run. So try application.run "matlabinit". But I think in this case adding a reference is preferable as you are unlikely to be distributing a spreadsheet calling matlab.

    Also have you made sure the addin is installed? In excel 2010 click on the developer tab, choose addins (with the big gold gear icon) and tick the Spreadsheet Link Ex Ver… for use with Matlab. Then go into VBA and add the reference as described above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple problem but I don't know how to solve it because
I have a little Problem but don't know the Solution! I have wrote a
I have problem with my code. I don't know what am I doing wrong.
I have the following problem and don't know how to code it in R:
I have a problem and don't know what to do. I'm using Visual C#
I'm have problem with Isometric. I'm don't know how to name this problem, but
I have this problem but I don't know how to name it, for instance,
First thing I know this is repeated question but I don't have problem in
I have a problem I don't know how to solve. I have an Indy10
I have a problem which I don't really know how to solve. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.