Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Filter by
Sorted by
Tagged with
0 votes
0 answers
24 views

Extracting free spaces from a occupancy grid map in the MATLAB

How can I extract free spaces from a occupancy grid map in the MATLAB. I have the following code which gave the output that there is no free cell on the occupancy grid map. clc; clear; close all; rng(...
Encipher's user avatar
  • 3,468
1 vote
0 answers
25 views

Configuration structure error with Fieldtrip in Matlab

I'm running into an error while attempting to setup a configuration structure for a single subjects EEG data using Fieldtrip. While I think the answer is plain, I am unable to figure out for the life ...
G_V_12's user avatar
  • 11
1 vote
0 answers
39 views

Want to get rid of "jagged teeth" from DTS simulator made in matlab

So I made a program in matlab that numerically simulates a DTS system and its almost right but there's one detail that there's "jagged teeth" in the graphic diagram ( circled in blue ) ...
LEO101's user avatar
  • 13
-2 votes
0 answers
27 views

How to change size of marker in rltool matlab

I want to make my poles and zeros markers bigger. In PLOT I had this option in properties, but in rltool I don't have the same option. I've tried to use set(0, 'DefaultLineMarkerSize', 8); but this is ...
BearShark's user avatar
1 vote
0 answers
53 views

Reassigning a Matlab pointer in a loop without a memory leak

We are using Matlab to communicate with a C++ library, and are struggling with memory management. We create a libpointer pointing to an array, and then try to update its value in a loop. I don't think ...
RPM's user avatar
  • 1,809
1 vote
0 answers
106 views

How to access and use data from .mat file in jupyter notebook? [closed]

I'm trying to access a .mat file which contains various fields (constants, vectors, variables) where the variables are 10000x100 matrices and vectors are of size 1x100. I tries to access the same ...
Rahul Chakraborty's user avatar
1 vote
0 answers
20 views

Grey Wolf Optimizer (GWO) MPPT in MATLAB/Simulink returns only lower bound value as reference speed

I am implementing a Grey Wolf Optimizer (GWO) for Maximum Power Point Tracking (MPPT) to generate the reference speed in a wind energy conversion system using Simulink. However, when I run the ...
Ayada Amira's user avatar
0 votes
0 answers
36 views

Ray tracing for the offner stretcher

Please help me refine the ray tracing code of the Stretcher Offner in MATLAB. I used the formulas from the article to plot graphs from Figure 3, showing the dependence of the group delay on the ...
Дмитрий Киселев's user avatar
0 votes
1 answer
48 views

Texture analysis image Matlab [closed]

I'm analyzing the texture of cell nuclei in fluorescence microscopy images. I’ve attached two example nuclei: one that is less bright but has strong texture — full of aggregates or “granular” patterns ...
MARIA RODRIGUEZ SANZ's user avatar
3 votes
0 answers
91 views

How can I plot diagonals of matrix?

I want to plot all the diagonals of a matrix. In the matrix row 1 contains information of time 1, row 2 of time 2 etc etc. Each diagonal presents the evolution of the number of fishes in a cohort that ...
Claris's user avatar
  • 31
-1 votes
1 answer
50 views

Matlab script to write to Excel file, have excel calculate, and read output in a for loop

I am trying to build a Matlab script to write data to an Excel file, have the excel file execute, and pull out another cell as the output. I asked an AI engine to give me a script and it came up with ...
Matt Pittard's user avatar
4 votes
2 answers
89 views

What is wrong with my implementation of logic in this MATLAB code?

I am stuck on a problem with my MATLAB code. This should behave as a pathing program for a calculation. However, it seems to not follow the logic I instructed it. The logic is that, at the current ...
William John Otsuro's user avatar
1 vote
0 answers
105 views

How to change window title of the base workspace of MATLAB Desktop GUI of R2025a onwards on Windows

How do you change window title of the base workspace of MATLAB desktop GUI for R2025a onwards on Windows 10? Prior to R2025a, mlservices gives an API: desktop = com.mathworks.mlservices....
Argyll's user avatar
  • 10.1k
1 vote
0 answers
90 views

Error in converting symbolic value to numerical value with subs()

I have a problem in MATLAB. I want to calculate the nonlinear system of equation using Newton Method. This nonlinear system of equation is taken from finite difference method. The system is Ay=F(y) ...
Ongky Denny Wijaya's user avatar
0 votes
0 answers
60 views

Applying a gain to a bus while preserving the signal name assignments

I have a bus if signals in MATLAB Simulink and I want to apply a gain to modify the signal values but preserve the naming elements of the bus, but when I apply a gain to the bus the output is just a ...
Alex Band's user avatar
2 votes
2 answers
170 views

How to check whether a name is a locally accessible function?

How to check whether a name is a locally accessible function and only locally accessible? For example, with function out = top_level_function(name) % ??? function helper2 end end function ...
Argyll's user avatar
  • 10.1k
2 votes
1 answer
197 views

How to filter and sum elements of a matrix in MATLAB based on multiple conditions without a loop?

I have the following numeric matrix in MATLAB: A = [3 2 7; 9 1 4; 5 6 8]; I want to sum all elements that are greater than 5 and are also even. I need to do this without using a loop, and store the ...
Nar.hhs's user avatar
  • 68
1 vote
1 answer
123 views

Python read matlab .mat file containing table

I'm trying to read a matlab .mat file (v7.3) from python. The thing is one of the field in the .mat object is a table (7x6) with named columns, and every time I read the object I only get a 1x6 array ...
gee3107's user avatar
  • 362
0 votes
0 answers
44 views

dSpace MicroLabBox Tx serial communications is writing transmissions straight to the receive buffer

I am using the dSpace MicroLabBox and am running their Real-Time Interface (RTI1202) on MATLAB 2024b. I am currently attempting to control a motor through RS485. I have the connection working and the ...
Tanner Burton's user avatar
0 votes
1 answer
27 views

Simulink 3DOF block not accounting for gravity?

im very new to Simulink and wanted to experiment with the 3DOF (Body Axels) block in Simulink. However my height is just constantly increasing even with no force applied. (I tried applying thrust for ...
ByGoalZ's user avatar
4 votes
1 answer
111 views

An issue with `parfor` in MATLAB R2023a--R2025a

Consider two MATLAB m files named profile.m and try_parfor.m as follows. % profile.m function profile() olddir = pwd(); cd(tempdir); fprintf('\nCurrent directory: %s\n', pwd()); func ...
Nuno's user avatar
  • 282
0 votes
0 answers
46 views

How to command live script to scroll to the bottom left corner of an output matrix

To show the bottom left of the matrix, I am manually scrolling down to the bottom of the matrix. I seek a command that will scroll down to the bottom left of the matrix. I do not want to crop the ...
gatorback's user avatar
  • 1,587
0 votes
0 answers
71 views

Weird Results in Robot Pathfinding Algorithm Testing Using MATLAB

Recently, I developed a MATLAB-based simulation to evaluate my robot pathfinding algorithm. The robots operate on a network of unidirectional tracks, where each robot computes a single path from its ...
CangWangu's user avatar
  • 181
0 votes
1 answer
92 views

MatLab 2025a Error switching the .NET Framework Error using dotnetenv

The framework is already loaded immediately after restarting Matlab 2025a. Error using dotnetenv .NET is loaded. To change the environment, restart MATLAB then call dotnetenv. Test code directly ...
xnet_dev's user avatar
1 vote
0 answers
18 views

Simulink inverse kinematics block goes unstable when RPY is time-varying (homogeneous transformation matrix)

I'm trying to use the MATLAB robotics toolbox, specifically with the inverse kinematics block. I started only giving the block the translation coordinates, and a weight vector of [0 0 0 1 1 1], which ...
Esteban Ricaurte's user avatar
4 votes
1 answer
67 views

How to find an sgtitle in a figure with a tiledlayout?

I have a figure with a tiledlayout. If I create an sgtitle I am unable to find that same sgtitle within the fh.Children structure. If I do not create a tiledlayout, then the sgtitle shows up in the ...
Matt's user avatar
  • 2,874
3 votes
1 answer
60 views

How to read multi-line input from clipboard at once?

How do you read multi-line input from clipboard at once? I tried using input but line change appears treated as Enter pressing. >> x=input(char.empty,'s'); 2020 2037 2054 2131 ans = ...
Argyll's user avatar
  • 10.1k
6 votes
1 answer
137 views

More than one dot in legend

I have created the first figure using legend normally. I would like to have more than one dot in the legend, so the colours are easier to recognize there, as in the second figure (which I created ...
Luis Mendo's user avatar
  • 113k
0 votes
0 answers
56 views

How to install libgfortran.3 on Mac Silicon for an old program

I need to run an old program that depends on MATLAB on my Mac with Apple Silicon, but I only have the precompiled binaries, not the .f source files. The program requires libgfortran.3, but modern ...
Gabriela A.'s user avatar
0 votes
0 answers
47 views

MATLAB Simulink error when trying to pass variables through function

I have three function blocks in my simulink model; A, B, C. I am feeding block A with data 'waypoints', which is an 11x2 array. I want block A to create a 'passthrough' for 'waypoints', such that ...
Tom W's user avatar
  • 1
2 votes
1 answer
46 views

Programmatically fix title to same height in tiledlayout (after movement from yticklabels)

Is there a way to fix the position of left-aligned axis titles regardless of the yticklabels? I am programmatically generating a series of axis objects, where the yticklabels are being autogenerated. ...
magnesium's user avatar
  • 639
0 votes
0 answers
80 views

Trying to graph of the relationship of the frequency and wave number of the spin wave

I've been trying to make this code into a function and gather the wave number, but how do I get the frequency and then collect the data bt changing the wave number and then graphing. Below here is the ...
Tommy Wigenton's user avatar
0 votes
0 answers
66 views

Decomposition of a large matrix in CP format (sum of products of matrices)

I have a matrix A of size n^2 by n^2, and I wanted to know if for a given accuracy (or a number r) there is a way to express A as the sum of Bi kron Ci for i=1...R where Bi, Ci are n by n? i.e. ...
Brice's user avatar
  • 9
0 votes
0 answers
45 views

Cannot successfully set input from workspace for Simulink test harness

I am trying to use the test harness to verify the function of my Simulink model. I set the input from Workspace, and write a .m file to build the input structure(I got embedded bus element in my bus ...
tyrela's user avatar
  • 101
0 votes
0 answers
34 views

Why does MATLAB selfAttentionLayer give different parameter counts for head/key-channel pairs with the same total key dimension?

I’m experimenting with the MathWorks example that inserts a multi-head self-attention layer into a simple CNN for the DigitDataset: Link to example layers = [ imageInputLayer([28 28 1]) ...
Hend mahmoud's user avatar
6 votes
4 answers
266 views

How to unpack a buffer of 12-bit values into an array of normalized float32

A measurement system (in our lab) produces data of 12 bits per sample in a packed format, i.e. 2 samples of 12 bits each are packed into 3 bytes: buf[l + 2] | buf[l + 1] | buf[l + 0] 7 6 5 ...
datenwolf's user avatar
  • 163k
0 votes
0 answers
101 views

PID function equivalent from MATLAB to Python

I manage to correctly simulate a closed loop with Simulink using pure python "control" library. However, I'm now trying to do the same with a new closed loop that has uses a PID controller: ...
João Schmidt's user avatar
0 votes
0 answers
82 views

How to include two named functions sequentially in one anonymous function

How do you include two named functions, which are not nested, in one anonymous function? For example, say I have a file mainFunction.m which contains function varargout = mainFunction(in1) % in1 is ...
Argyll's user avatar
  • 10.1k
1 vote
0 answers
36 views

DAQ stops during AlazarWaitAsyncBufferComplete() call - how to maintain background operation?

I'm using a MATLAB DAQ for triggering and an Alazar digitizer (ATS-9352) for data acquisition. The DAQ stops its background operation when I call AlazarWaitAsyncBufferComplete(), but I need both to ...
Hyojeong Shon's user avatar
3 votes
1 answer
82 views

How to return a vector of strings (or chars) when input data is an object with chars (not concatenated chars)

If I have a class like this: classdef Person properties Name Age Weight end methods function obj = Person(name, age, weight) obj.Name = name; obj.Age = age; obj....
Angus Comber's user avatar
  • 9,864
3 votes
1 answer
60 views

Plotting a parametric surface where the domain is non-rectangular

Hey I'm teaching a calculus course, and for an example in my lecture on surface integrals I would like to generate a surface plot in MATLAB of a portion of a circular cylinder. Here is my MATLAB code ...
ಠ_ಠ's user avatar
  • 133
5 votes
5 answers
157 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 ...
MaxD's user avatar
  • 157
5 votes
1 answer
133 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, ...
dogAwakeCat's user avatar
1 vote
1 answer
129 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 ...
Can Ömercikoğlu's user avatar
1 vote
1 answer
103 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 ...
Naraghazi's user avatar
  • 121
3 votes
1 answer
59 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' } {'...
Angus Comber's user avatar
  • 9,864
-1 votes
1 answer
92 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 (...
Ellie's user avatar
  • 303
3 votes
1 answer
84 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 ...
user31119379's user avatar
1 vote
1 answer
84 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',...
X602734's user avatar
  • 11
5 votes
2 answers
91 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])), ...
ThomasIsCoding's user avatar

1
2 3 4 5
1894