94,746 questions
2
votes
4
answers
73
views
How can I quickly enable or disable single terms in a long sum?
I have a long expression of the (simplified) form x = 1 + 2 + 3 + 4 + 5 that I would like to "play around with" by quickly excluding or including specific numbers from the sum.
My idea was ...
2
votes
1
answer
98
views
std::format in a mex file
I'm trying to use std::format in a mex file but get an unresolved external symbol error when I use std as a module.
// test_mex.cpp
#include "mex.h"
import std;
void mexFunction(int nlhs, ...
1
vote
1
answer
57
views
Simulink DDS Blockset: No data received (no errors), what could be wrong and how to fix?
I'm using MATLAB R2023b with the DDS Blockset and Fast DDS as the middleware. I’m trying to publish a boolean signal (headlightOn) from one Simulink model and receive it in another.
Everything builds ...
0
votes
0
answers
61
views
Force simulink solver to follow specific time steps
I have Simulink model with continuous states with variable-step solver. Is there way to force the solver to execute at a specific nonuniform time steps, let say t0, t1, t2, ..., tn? To clarify, I am ...
2
votes
1
answer
47
views
How to return a vector of the 2nd element in each cell array specified
If I have a cell array like this:
>> mycellarray = [{'Country' 'State' '1/22/01' '1/23/01' '1/24/01'};{'Afghanistan' '' [0 0] [0 1] [0 2]}]
mycellarray =
2×5 cell array
{'Country' } {'...
0
votes
1
answer
64
views
How to compute the same surface area as regionprops3 without using regionprops3?
I need to compute the sphericity of a 3D object (binary mask) in MATLAB, especially for non-isotropic voxel spacing. To do this, I need an accurate surface area measurement.
I compared two methods (...
2
votes
1
answer
41
views
How do I plot two grouped sets of violin plots on a single X axis using MATLAB's violinplot?
The code below creates violin plots grouped by mean values. I'm currently plotting these grouped violin plots next to each other using subplots. How would I modify the code to get them to plot onto a ...
1
vote
0
answers
40
views
How to chain subprocesses of external software in Python?
I have a script that opens a MATLAB command window and inputs command in it:
# Command to start MATLAB and run the script
matlab_command = [
matlab_executable,
'-nodesktop',
'-nosplash',
'-r',...
4
votes
2
answers
64
views
How to pass cell indexing as an input argument to a function, such that cell inside the function can use the indexing directly?
I am wondering if we can pass cell indexing as an input argument to a function, such that a cell inside the function can parse it.
For example, given a cell like x = num2cell(reshape(1:24, [2,3,4])), ...
5
votes
1
answer
93
views
Efficient filtering of sparse matrix from full
I have a large, full, dense, symmetric matrix (eg 30k2 or 60k2 positive elements, ~100% density). I want to extract either (i) the top (eg) 1% highest values; or (2) the values above a user-specified ...
0
votes
0
answers
42
views
How to force MATLAB/Simulink to use symbolic link
In Windows, is there a way to force MATLAB to use symbolic link for the workspace directory? I tried both symbolic link as well as directory junction, but MATLAB/Simulink always resolves the link ...
1
vote
0
answers
62
views
Computing the dot product of a matrix in MatLAb
I am trying to compute the dot product of a matrix in Matlab. The algorithms in each problem were generated using this website.
To do so, I am required to use the function I created in the previous ...
1
vote
2
answers
65
views
Symbolic Summation of Terms with Varying Subscripts using MATLAB
I'd like to change the subscripts of xi and eta, but none of the other posts I've found have helped. Eventually, I need to multiply the entire summation with every element in a matrix dependent on ...
4
votes
1
answer
375
views
MATLAB 2025a vs. Fortran MEX files with internal subroutines
This very likely is a bug in MATLAB R2025a on Ubuntu, and a bug report has been submitted to MathWorks. While they investigate, I would like to know: is there anything wrong with the Fortran MEX file (...
1
vote
0
answers
29
views
Track number of in-use vs. idle workers in Matlab with fmincon
I'm currently in Matlab doing a set of fixed point iterations using fmincon. I use parfor multithreading to do so. However, one of my iterations in the parfor loop goes particularly slow just because ...