From 318ad26cca96fb41c20e3afaa54d86c868d2067b Mon Sep 17 00:00:00 2001
From: Etienne Gavazzi <98973824+egavazzi@users.noreply.github.com>
Date: Sat, 16 Mar 2024 21:56:16 +0100
Subject: [PATCH 1/6] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 818c53e..6db5147 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
## MATLAB
-| ❗ Windows and MacOS platforms : MATLAB versions R2022 and R2023 do not work with `MATLAB.jl` ❗
You can use older versions as explained [further down](https://github.com/JuliaInterop/MATLAB.jl#changing-matlab-version). |
+| ❗ If you get some 'Segmentation fault' error when calling MATLAB with version R2022 or newer, try using an [older version](https://github.com/JuliaInterop/MATLAB.jl#changing-matlab-version).❗ |
|:----:|
The `MATLAB.jl` package provides an interface for using [MATLAB®](http://www.mathworks.com/products/matlab/) from [Julia](http://julialang.org) using the MATLAB C api. In other words, this package allows users to call MATLAB functions within Julia, thus making it easy to interoperate with MATLAB from the Julia language.
From 8a6535ba8b7f53c93b773d8707044fc0d255b205 Mon Sep 17 00:00:00 2001
From: Etienne Gavazzi <98973824+egavazzi@users.noreply.github.com>
Date: Sat, 16 Mar 2024 21:57:41 +0100
Subject: [PATCH 2/6] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6db5147..d9dd41e 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
## MATLAB
-| ❗ If you get some 'Segmentation fault' error when calling MATLAB with version R2022 or newer, try using an [older version](https://github.com/JuliaInterop/MATLAB.jl#changing-matlab-version).❗ |
+| ❗ If you get a 'Segmentation fault' error when calling MATLAB with version R2022 or newer, try using an [older version](https://github.com/JuliaInterop/MATLAB.jl#changing-matlab-version) of MATLAB. ❗ |
|:----:|
The `MATLAB.jl` package provides an interface for using [MATLAB®](http://www.mathworks.com/products/matlab/) from [Julia](http://julialang.org) using the MATLAB C api. In other words, this package allows users to call MATLAB functions within Julia, thus making it easy to interoperate with MATLAB from the Julia language.
From faf874e4af49620db73f69951d3e20345b1a7e1b Mon Sep 17 00:00:00 2001
From: Benjamin K
Date: Sun, 9 Feb 2025 11:40:35 +0100
Subject: [PATCH 3/6] Add conversion for tuples
---
src/mxarray.jl | 32 +++++++++++++++++++++++++++++++-
test/mxarray.jl | 22 ++++++++++++++++++++++
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/src/mxarray.jl b/src/mxarray.jl
index ae77272..cb423bc 100644
--- a/src/mxarray.jl
+++ b/src/mxarray.jl
@@ -289,7 +289,7 @@ function mxarray(a::AbstractArray{T}) where {T<:MxRealNum}
return mx
end
-function mxarray(a::AbstractArray{T}) where {T<:MxComplexNum}
+function mxarray(a::AbstractArray{T}) where {T <: MxComplexNum}
mx = mxarray(T, size(a))
na = length(a)
rdat = unsafe_wrap(Array, real_ptr(mx), na)
@@ -302,6 +302,36 @@ function mxarray(a::AbstractArray{T}) where {T<:MxComplexNum}
end
+function mxarray(a::NTuple{N, T}) where {N, T <: MxRealNum}
+ mx = mxarray(T, N)
+ pdat = ccall(mx_get_data[], Ptr{T}, (Ptr{Cvoid},), mx)
+ dat = unsafe_wrap(Array, pdat, N)
+ for i in 1:N
+ dat[i] = a[i]
+ end
+ return mx
+end
+
+function mxarray(a::NTuple{N, T}) where {N, T <: MxComplexNum}
+ mx = mxarray(T, size(a))
+ na = length(a)
+ rdat = unsafe_wrap(Array, real_ptr(mx), na)
+ idat = unsafe_wrap(Array, imag_ptr(mx), na)
+ for (i, ix) in enumerate(eachindex(a))
+ rdat[i] = real(a[ix])
+ idat[i] = imag(a[ix])
+ end
+ return mx
+end
+
+function mxarray(a::Tuple)
+ mx = mxcellarray(length(a))
+ for i in 1:length(a)
+ set_cell(mx, i, mxarray(a[i]))
+ end
+ return mx
+end
+
# sparse matrix
function mxsparse(ty::Type{Float64}, m::Integer, n::Integer, nzmax::Integer)
diff --git a/test/mxarray.jl b/test/mxarray.jl
index b92b1cb..a712dd6 100644
--- a/test/mxarray.jl
+++ b/test/mxarray.jl
@@ -405,6 +405,28 @@ delete(x)
@test isa(y, Array{Bool,3})
@test isequal(y, a)
+# Issue: Tuples converted to MATLAB structs
+# https://github.com/JuliaInterop/MATLAB.jl/issues/178
+a = (2.5, 2.6)
+x = mxarray(a)
+y = jvalue(x)
+@test classid(x) == MATLAB.mxDOUBLE_CLASS
+@test nrows(x) == 2
+@test ncols(x) == 1
+delete(x)
+@test isa(y, Vector{Float64})
+@test isequal(y, collect(a))
+
+# Tuple with mixed types
+a = (1, 2.0, "MATLAB", [1, 2, 3])
+x = mxarray(a)
+y = jvalue(x)
+@test nrows(x) == 4
+@test ncols(x) == 1
+@test classid(x) == MATLAB.mxCELL_CLASS
+@test isa(y, Vector{Any})
+@test length(y) == length(a)
+@test isequal(y, collect(a))
##############################
From 3199dc637a2a5613deb713cc834b23b3cf726185 Mon Sep 17 00:00:00 2001
From: "Viral B. Shah"
Date: Sun, 9 Feb 2025 11:28:05 -0500
Subject: [PATCH 4/6] Create dependabot.yml
---
.github/dependabot.yml | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 .github/dependabot.yml
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..d60f070
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,7 @@
+# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/" # Location of package manifests
+ schedule:
+ interval: "monthly"
From 11bcda915e3daf061f8d72af8e566c7b88b1d898 Mon Sep 17 00:00:00 2001
From: "Viral B. Shah"
Date: Sun, 9 Feb 2025 11:28:36 -0500
Subject: [PATCH 5/6] Update TagBot.yml
---
.github/workflows/TagBot.yml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml
index 778c06f..90dc100 100644
--- a/.github/workflows/TagBot.yml
+++ b/.github/workflows/TagBot.yml
@@ -4,6 +4,22 @@ on:
types:
- created
workflow_dispatch:
+ inputs:
+ lookback:
+ default: 3
+permissions:
+ actions: read
+ checks: read
+ contents: write
+ deployments: read
+ issues: read
+ discussions: read
+ packages: read
+ pages: read
+ pull-requests: read
+ repository-projects: read
+ security-events: read
+ statuses: read
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
@@ -12,3 +28,6 @@ jobs:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
+ # Edit the following line to reflect the actual name of the GitHub Secret containing your private key
+ ssh: ${{ secrets.DOCUMENTER_KEY }}
+ # ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }}
From 3d178ca534c2a6c26bc6e1e020c50ecbf45dc92f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 9 Feb 2025 16:28:41 +0000
Subject: [PATCH 6/6] Bump actions/checkout from 2 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v4)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
---
.github/workflows/CI.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 3d9a89b..0f1e650 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -24,7 +24,7 @@ jobs:
arch:
- x64
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.version }}