# \#matlab

**URL:** https://discourse.julialang.org/tag/matlab/89.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [MATLAB.jl not supporting cwt()?](https://discourse.julialang.org/t/matlab-jl-not-supporting-cwt/137581)

<div class="topic-metadata">

**Author:** [@mahmah](https://discourse.julialang.org/u/mahmah)\
**Replies:** 3\
**Last updated:** [June 12, 2026, 11:52am UTC](https://discourse.julialang.org/t/matlab-jl-not-supporting-cwt/137581 "2026-06-12T11:52:14Z")

</div>

Hi, I am getting no output for this: using MATLAB mat"cwt($x)" Whereas for instance this works fine: mat"fft($x)" Any clues?

---

## [Performance of Julia binary wrapper behind Matlab mex-file interface performance](https://discourse.julialang.org/t/performance-of-julia-binary-wrapper-behind-matlab-mex-file-interface-performance/126946)

<div class="topic-metadata">

**Author:** [@andreasvarga](https://discourse.julialang.org/u/andreasvarga)\
**Replies:** 38\
**Last updated:** [May 17, 2026, 11:00pm UTC](https://discourse.julialang.org/t/performance-of-julia-binary-wrapper-behind-matlab-mex-file-interface-performance/126946 "2026-05-17T23:00:44Z")

</div>

Recently I implemented a julia wrapper for a subroutine of the SLICOT library (specifically SB03MD to solve Lyapunov matrix equations). I used the generated binary wrappers in conjunction with Intel’s MKL, which is used…

---

## [Use MAT.jl to save a .mat file containing a MATLAB struct array](https://discourse.julialang.org/t/use-mat-jl-to-save-a-mat-file-containing-a-matlab-struct-array/63450)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 2\
**Last updated:** [November 25, 2025, 6:25pm UTC](https://discourse.julialang.org/t/use-mat-jl-to-save-a-mat-file-containing-a-matlab-struct-array/63450 "2025-11-25T18:25:33Z")

</div>

Does anyone know if it’s possible to use MAT.jl to write a .mat file that contains a MATLAB struct array? It would be nice if something like this worked: julia\> using MAT julia\> struct A x::Int y:…

---

## [Null initialisation for a loop that appends vectors](https://discourse.julialang.org/t/null-initialisation-for-a-loop-that-appends-vectors/131754)

<div class="topic-metadata">

**Author:** [@rcomm](https://discourse.julialang.org/u/rcomm)\
**Replies:** 14\
**Last updated:** [August 24, 2025, 5:35pm UTC](https://discourse.julialang.org/t/null-initialisation-for-a-loop-that-appends-vectors/131754 "2025-08-24T17:35:48Z")

</div>

In Matlab, it is common to initialise a loop like this: x = ; for i = 1:n; x = \[x; another numerical row vector (of fixed length L)\]; end This creates a matrix of size \[n,L\]. It works regardless of chosen length L. W…

---

## [Translating Matlab to Julia](https://discourse.julialang.org/t/translating-matlab-to-julia/129864)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [June 13, 2025, 5:39pm UTC](https://discourse.julialang.org/t/translating-matlab-to-julia/129864 "2025-06-13T17:39:14Z")

</div>

I am translating some code from Matlab to Julia. I found out that the author is using a lot of Matlab functions with the same name but different functionality, which are stored in different folders. Before using these …

---

## [Getting MATLAB.jl on Windows to work](https://discourse.julialang.org/t/getting-matlab-jl-on-windows-to-work/124575)

<div class="topic-metadata">

**Author:** [@hatmatrix](https://discourse.julialang.org/u/hatmatrix)\
**Replies:** 5\
**Last updated:** [April 28, 2025, 8:41pm UTC](https://discourse.julialang.org/t/getting-matlab-jl-on-windows-to-work/124575 "2025-04-28T20:41:10Z")

</div>

Hello everyone, I raised an issue on the GitHub repo but looks like it’s not very active so just wanted to see if anyone else had this problem and a fix. I’ve added MATLAB in Julia v1.11 through the package manager. I a…

---

## [Implementation of Octave functions in Julia](https://discourse.julialang.org/t/implementation-of-octave-functions-in-julia/39631)

<div class="topic-metadata">

**Author:** [@alejandrovpm](https://discourse.julialang.org/u/alejandrovpm)\
**Replies:** 16\
**Last updated:** [February 5, 2025, 5:27pm UTC](https://discourse.julialang.org/t/implementation-of-octave-functions-in-julia/39631 "2025-02-05T17:27:15Z")

</div>

Hello everyone, I wonder if there is a way to implement Matlab functions via Octave in Julia. I know there exists Matlab.jl but for using it you need to install a Matlab version in your computer. I ask this question be…

---

## [Median of complex numbers different from Matlab output](https://discourse.julialang.org/t/median-of-complex-numbers-different-from-matlab-output/117352)

<div class="topic-metadata">

**Author:** [@shindelr](https://discourse.julialang.org/u/shindelr)\
**Replies:** 15\
**Last updated:** [December 2, 2024, 2:14pm UTC](https://discourse.julialang.org/t/median-of-complex-numbers-different-from-matlab-output/117352 "2024-12-02T14:14:36Z")

</div>

Hi there everyone! This is my first ever post in the Julia community and since I’m unfamiliar with the various tags and categories on here, I just put this question in General. I’m currently in the process of porting a …

---

## [Julia can be dramatically slower than Matlab when solving 2D PDE](https://discourse.julialang.org/t/julia-can-be-dramatically-slower-than-matlab-when-solving-2d-pde/122321)

<div class="topic-metadata">

**Author:** [@Alex90](https://discourse.julialang.org/u/Alex90)\
**Replies:** 42\
**Last updated:** [November 9, 2024, 2:25pm UTC](https://discourse.julialang.org/t/julia-can-be-dramatically-slower-than-matlab-when-solving-2d-pde/122321 "2024-11-09T14:25:33Z")

</div>

Hello, It is said that Julia is very fast in comparison with other high level languages. SInce i do scientific computing, i was interested in this language. So i compared performance of Julia and Matlab when solving two…

---

## [MATLAB is faster for my large system of ODEs?](https://discourse.julialang.org/t/matlab-is-faster-for-my-large-system-of-odes/122610)

<div class="topic-metadata">

**Author:** [@martru](https://discourse.julialang.org/u/martru)\
**Replies:** 21\
**Last updated:** [November 15, 2024, 6:12pm UTC](https://discourse.julialang.org/t/matlab-is-faster-for-my-large-system-of-odes/122610 "2024-11-15T18:12:50Z")

</div>

Excuse the deliberately provocative title :slight\_smile: I have a very large system of ODEs of the form: dot{x} = Ax + Bu A is a sparse matrix 5505x5505. B\*u is a 5505 element vector. Using ode45 in matlab, it solves …

---

## [Help with for-loops optimization / Translation from Matlab](https://discourse.julialang.org/t/help-with-for-loops-optimization-translation-from-matlab/118204)

<div class="topic-metadata">

**Author:** [@Benjamin7](https://discourse.julialang.org/u/Benjamin7)\
**Replies:** 7\
**Last updated:** [August 15, 2024, 7:42am UTC](https://discourse.julialang.org/t/help-with-for-loops-optimization-translation-from-matlab/118204 "2024-08-15T07:42:59Z")

</div>

Hi, I have been asked to translate a matlab code to Julia to gain speed, what I have done is to put each for loop with the @inbound, put each array and all important code in a function, I have defined the type of almost …

---

## [Shannon wavelet entropy](https://discourse.julialang.org/t/shannon-wavelet-entropy/114319)

<div class="topic-metadata">

**Author:** [@ahrensma](https://discourse.julialang.org/u/ahrensma)\
**Replies:** 3\
**Last updated:** [May 23, 2024, 7:31am UTC](https://discourse.julialang.org/t/shannon-wavelet-entropy/114319 "2024-05-23T07:31:31Z")

</div>

Hello, I look for a function similar to the wentropy function in the Wavelet Toolbox of Matlab. In an older code I used to following form: H = -wentropy( DataArray , 'shannon' ); I look in several packages (Wavelet.jl…

---

## [Oscar and Matlab both call nrows](https://discourse.julialang.org/t/oscar-and-matlab-both-call-nrows/114157)

<div class="topic-metadata">

**Author:** [@ilovemath](https://discourse.julialang.org/u/ilovemath)\
**Replies:** 9\
**Last updated:** [May 14, 2024, 3:42am UTC](https://discourse.julialang.org/t/oscar-and-matlab-both-call-nrows/114157 "2024-05-14T03:42:46Z")

</div>

Hi there, So, I am calling both Oscar and Matlab packages. Both call nrows in their subroutines under the hood in their often typical function calls. I was able to write the code so that I would not get the warning sa…

---

## [Butterworth Filter compared to Butter in Matlab](https://discourse.julialang.org/t/butterworth-filter-compared-to-butter-in-matlab/114201)

<div class="topic-metadata">

**Author:** [@ahrensma](https://discourse.julialang.org/u/ahrensma)\
**Replies:** 2\
**Last updated:** [May 13, 2024, 5:51pm UTC](https://discourse.julialang.org/t/butterworth-filter-compared-to-butter-in-matlab/114201 "2024-05-13T17:51:04Z")

</div>

Hello, I am not yet fully familiar with Julia and am currently struggling with the DSP / Butterworth filter. My original Matlab-Code is x = linspace(0, 10, 100); y1 = sin(x); \[b,a\] = butter(3,0.1,'high') y2 = filter(b,…

---

## [How to import data from MATLAB \`.mat\` files?](https://discourse.julialang.org/t/how-to-import-data-from-matlab-mat-files/114059)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 3\
**Last updated:** [May 9, 2024, 3:35pm UTC](https://discourse.julialang.org/t/how-to-import-data-from-matlab-mat-files/114059 "2024-05-09T15:35:10Z")

</div>

Can Julia import data from .mat files directly?

---

## [MATLAB.jl crashing in Julia 1.10 for MATLAB later than 2021a (according to issue)](https://discourse.julialang.org/t/matlab-jl-crashing-in-julia-1-10-for-matlab-later-than-2021a-according-to-issue/113998)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 0\
**Last updated:** [May 8, 2024, 1:02pm UTC](https://discourse.julialang.org/t/matlab-jl-crashing-in-julia-1-10-for-matlab-later-than-2021a-according-to-issue/113998 "2024-05-08T13:02:14Z")

</div>

Any thoughts on why the issue described below is happening or what can be done to fix it for the current versions? I’m getting the julia crash out when trying mat"version" MATLAB.jl fails to run in Julia 1.10 for versi…

---

## [Optimization, from MATLAB to Julia](https://discourse.julialang.org/t/optimization-from-matlab-to-julia/111212)

<div class="topic-metadata">

**Author:** [@cu2mauro](https://discourse.julialang.org/u/cu2mauro)\
**Replies:** 10\
**Last updated:** [April 13, 2024, 11:43am UTC](https://discourse.julialang.org/t/optimization-from-matlab-to-julia/111212 "2024-04-13T11:43:23Z")

</div>

Hi there! I am fairly new to Julia, I was converted after seeing some awesome performance compared to MATLAB, which I currently use. I tried rewriting in Julia an optimization problem that I had in MATLAB, and everythin…

---

## [Is there a Julia equivalent of Matlab's Array(i) = Value for undefined indicies?](https://discourse.julialang.org/t/is-there-a-julia-equivalent-of-matlabs-array-i-value-for-undefined-indicies/111167)

<div class="topic-metadata">

**Author:** [@MonkeyZK](https://discourse.julialang.org/u/MonkeyZK)\
**Replies:** 15\
**Last updated:** [March 15, 2024, 5:41pm UTC](https://discourse.julialang.org/t/is-there-a-julia-equivalent-of-matlabs-array-i-value-for-undefined-indicies/111167 "2024-03-15T17:41:44Z")

</div>

As the title suggest I was curious if Julia base or LinearAlgebra had some existing equivalent to Matlab’s implementation of assigning values to a non-exisiting index: \>\> Array = \[\]; Array(3) = 3; Array(5) = 5; Array(3,…

---

## [Running a Julia script from MATLAB using system()](https://discourse.julialang.org/t/running-a-julia-script-from-matlab-using-system/109931)

<div class="topic-metadata">

**Author:** [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Replies:** 1\
**Last updated:** [February 9, 2024, 3:08pm UTC](https://discourse.julialang.org/t/running-a-julia-script-from-matlab-using-system/109931 "2024-02-09T15:08:26Z")

</div>

Hello, I’m trying to run a Julia .jl script in a MATLAB program using the system command. The script runs perfectly fine, when I attempt to do so from the terminal, but I get a segmentation fault when I try to run it th…

---

## [Rewriting a MATLAB library in Julia](https://discourse.julialang.org/t/rewriting-a-matlab-library-in-julia/109515)

<div class="topic-metadata">

**Author:** [@jackmarry](https://discourse.julialang.org/u/jackmarry)\
**Replies:** 11\
**Last updated:** [February 5, 2024, 9:34am UTC](https://discourse.julialang.org/t/rewriting-a-matlab-library-in-julia/109515 "2024-02-05T09:34:19Z")

</div>

I am rewriting a MATLAB library in Julia, but I’ve noticed significant differences between Julia syntax and MATLAB. Additionally, GPT often provides incorrect responses. Is there a website that collects tables mapping MA…

---

## [Convergence behavior in MATLAB vs Julia](https://discourse.julialang.org/t/convergence-behavior-in-matlab-vs-julia/109113)

<div class="topic-metadata">

**Author:** [@Gast](https://discourse.julialang.org/u/Gast)\
**Replies:** 12\
**Last updated:** [January 25, 2024, 8:13am UTC](https://discourse.julialang.org/t/convergence-behavior-in-matlab-vs-julia/109113 "2024-01-25T08:13:07Z")

</div>

I am facing challenges in replicating a nonlinear unconstrained dynamic optimization problem originally coded in MATLAB using Julia. While the convergence of the algorithm is successful in MATLAB, I cannot achieve conver…

---

## [Error when run GRETNA in MATLAB](https://discourse.julialang.org/t/error-when-run-gretna-in-matlab/108083)

<div class="topic-metadata">

**Author:** [@Sally](https://discourse.julialang.org/u/Sally)\
**Replies:** 5\
**Last updated:** [December 27, 2023, 7:42am UTC](https://discourse.julialang.org/t/error-when-run-gretna-in-matlab/108083 "2023-12-27T07:42:25Z")

</div>

Hello everyone, I use MacBook Pro M1 with macOS 14.2.1. When I run GRETNA in MATLAB, the following error message appears: Referenced from: \<91A4AFCA-5C23-6A30-FB8C-A4C2CD09609E\> /Users/mymatalbtoolbox/GRETNA-2.0.0\_re…

---

## [Reproducing MATLAB's \`filter\` behavior](https://discourse.julialang.org/t/reproducing-matlabs-filter-behavior/107619)

<div class="topic-metadata">

**Author:** [@Abdulrhmn\_Ghanem](https://discourse.julialang.org/u/Abdulrhmn_Ghanem)\
**Replies:** 2\
**Last updated:** [December 14, 2023, 5:50pm UTC](https://discourse.julialang.org/t/reproducing-matlabs-filter-behavior/107619 "2023-12-14T17:50:08Z")

</div>

Hi I am trying to reproduce the following matlab code using julia. NEst = 1000 % length estimation record \[b,a\] = cheby1(3, 0.5, 2\*\[0.15 0.3\]); % the coefficients of the true IIR system % gen…

---

## [MATLAB-like \`unique\` where you can recreate the original with indices](https://discourse.julialang.org/t/matlab-like-unique-where-you-can-recreate-the-original-with-indices/77968)

<div class="topic-metadata">

**Author:** [@iamed2](https://discourse.julialang.org/u/iamed2)\
**Replies:** 8\
**Last updated:** [December 8, 2023, 8:05pm UTC](https://discourse.julialang.org/t/matlab-like-unique-where-you-can-recreate-the-original-with-indices/77968 "2023-12-08T20:05:30Z")

</div>

Is there an implementation of the MATLAB 3-output unique in Julia? In particular I’m looking for an efficient way to recreate the original input from the unique elements, like C(ic) in MATLAB. Previous discussions have…

---

## [Converting non-linear optimization with fmincom from Matlab to Julia](https://discourse.julialang.org/t/converting-non-linear-optimization-with-fmincom-from-matlab-to-julia/106536)

<div class="topic-metadata">

**Author:** [@Alfespo97](https://discourse.julialang.org/u/Alfespo97)\
**Replies:** 12\
**Last updated:** [November 23, 2023, 5:23pm UTC](https://discourse.julialang.org/t/converting-non-linear-optimization-with-fmincom-from-matlab-to-julia/106536 "2023-11-23T17:23:11Z")

</div>

Hi, I’m new to Julia language and I’m trying to replicate an optimization function created in Matlab using fmincom in Julia in order to improve the computation time that is quite huge in Matlab. I’ve used the JuMP mode…

---

## [Why Julia is much slower than MATLAB on GPU computing?](https://discourse.julialang.org/t/why-julia-is-much-slower-than-matlab-on-gpu-computing/106450)

<div class="topic-metadata">

**Author:** [@DennisFang](https://discourse.julialang.org/u/DennisFang)\
**Replies:** 30\
**Last updated:** [November 20, 2023, 12:44pm UTC](https://discourse.julialang.org/t/why-julia-is-much-slower-than-matlab-on-gpu-computing/106450 "2023-11-20T12:44:29Z")

</div>

Hello, I use a local computer, consisting of an NVIDIA RTX 3090 GPU, with a Windows 10 system to run models in different programming languages and compare their performance. When comparing Julia (v1.9.3) and MATLAB (202…

---

## [How can I give a function to eigs() in julia like matlab](https://discourse.julialang.org/t/how-can-i-give-a-function-to-eigs-in-julia-like-matlab/105699)

<div class="topic-metadata">

**Author:** [@Meteoooor](https://discourse.julialang.org/u/Meteoooor)\
**Replies:** 6\
**Last updated:** [November 3, 2023, 7:57am UTC](https://discourse.julialang.org/t/how-can-i-give-a-function-to-eigs-in-julia-like-matlab/105699 "2023-11-03T07:57:05Z")

</div>

I have the following matlab code: function \[ DomRVec, DomEig, Error \] = MyEigs( Tup, Tdn, NumofValue, SpeString, Dbond, Dspin, InitVec ) VecDim = Dbond^2; Tup = reshape( permute( Tup, \[ 1, 3, 2 \] ), \[ Dbond \* Dspin, D…

---

## [Implement of Matlab function "nargout" in Julia](https://discourse.julialang.org/t/implement-of-matlab-function-nargout-in-julia/104011)

<div class="topic-metadata">

**Author:** [@Meteoooor](https://discourse.julialang.org/u/Meteoooor)\
**Replies:** 3\
**Last updated:** [September 19, 2023, 9:18am UTC](https://discourse.julialang.org/t/implement-of-matlab-function-nargout-in-julia/104011 "2023-09-19T09:18:20Z")

</div>

It is easy to dynamically obtain the number of output variables in MATLAB by function “nargout”，how can I do such in Julia? For example,these is the code in MATLAB function \[ varargout \] = CopyElement( V ) % V is a ten…

---

## [Trying to translate Matlab code to Julia - need help #50640](https://discourse.julialang.org/t/trying-to-translate-matlab-code-to-julia-need-help-50640/102111)

<div class="topic-metadata">

**Author:** [@manuelcaeiro](https://discourse.julialang.org/u/manuelcaeiro)\
**Replies:** 14\
**Last updated:** [July 27, 2023, 6:26pm UTC](https://discourse.julialang.org/t/trying-to-translate-matlab-code-to-julia-need-help-50640/102111 "2023-07-27T18:26:38Z")

</div>

I’m trying to translate the following code in Matlab: e = 1.05; %Eccentricity a = -147562.72; %km b = abs(a)\*sqrt(e.^2 -1); %Equation for Semi-Minor Axis, b x1 = linspace( a, 2\*a, 1E3); %…

---

## [Improving runtime](https://discourse.julialang.org/t/improving-runtime/101405)

<div class="topic-metadata">

**Author:** [@Moslem\_Uddin](https://discourse.julialang.org/u/Moslem_Uddin)\
**Replies:** 10\
**Last updated:** [July 14, 2023, 10:55am UTC](https://discourse.julialang.org/t/improving-runtime/101405 "2023-07-14T10:55:21Z")

</div>

I’m a new user of JULIA. The following code is a line by translation from MATLAB with the aim of comparing runtime. However, it seems like the performance doesn’t improve. I’ll be happy to have feedback on why it’s the c…

[Next page](https://discourse.julialang.org/tag/matlab/89.md?match_all_tags=true&page=1&tags%5B%5D=matlab)
