Answered
Data splitting and saving to different variables
Can you dynamically create variables with numbered names like x1, x2, x3, etc.? Yes. Should you do this? The general consensus ...

4 years ago | 0

Answered
sometimes datastore read() function reads number of lines different than 'readsize' parameter
If you look at the description of the ReadSize property of the tabularTextDatastore class, the sentence describing the behavior ...

4 years ago | 0

Answered
Install Matlab engine for Python on MacBook M1
If you are using the MATLAB R2022a Native Apple Silicon Platform Open Beta, one of the limitations listed on that page is "MATLA...

4 years ago | 0

Answered
When using ind2rgb, how do you use map as output argument?
The map input to ind2rgb is the colormap for the image. The first input to ind2rgb represents indices into that colormap. So for...

4 years ago | 1

| accepted

Answered
Using graph theory inside Simulink
Some of the "Graph and Network Algorithms" functions in MATLAB support the C/C++ Code Generation extended capability, as you can...

4 years ago | 0

| accepted

Answered
Why 'NaT' (class: datetime) does not work with find function?
The reason why isnat works and your == call did not is because NaT is like NaN -- it is not equal to anything, not even another ...

4 years ago | 2

Answered
Create array of results for summation where limits are not the same
I don't have your data so I can't run the code, but something along these lines should work. I use groupsummary to summarize (in...

4 years ago | 1

| accepted

Answered
What is a handle?
What's the context in which you see that term? There are at least three different meanings for that term, though two of them are...

4 years ago | 3

| accepted

Answered
Error creating structure field names with a for loop
The first character of a struct field name must be a letter. Later characters can be digits, but not the first one. You could s...

4 years ago | 1

| accepted

Answered
Index exceeds the number of array elements - Error message
x = 1:10 y = reshape(x, 2, []) m = mean(y, 1) % mean of each column; "collapse" dimension 1 to size 1 by taking the mean m2 =...

4 years ago | 0

Answered
create index to graph and find isomorphism
Can you dynamically create variables with numbered names like G1, G2, G3, etc.? Yes. Should you do this? The general consensus ...

4 years ago | 0

| accepted

Answered
Create Structure from cell array with dot separation in string
s = 'em1500.eta_t.x'; f = split(s, '.') At this point you may want to use matlab.lang.makeValidName to ensure the field names ...

4 years ago | 0

Answered
Create a time array
val=['17-10-58_086' '17-11-09_923']; val = string(val); Convert the string array val into a format the duration function ...

4 years ago | 1

| accepted

Answered
Is "DSP System Toolbox Support Package for ARM Cortex-M Processors" available for Matlab R2022a?
The Release Compatibility information for that support package states that it is compatible with release R2014a through R2018b. ...

4 years ago | 0

Answered
Is there a reason why row vectors are default in Matlab?
Both the "A History of MATLAB" article that Cleve Moler and Jack Little wrote that was published by the ACM (see this blog post)...

4 years ago | 4

Answered
How can I get randperm function to calculate assigned percentage and values?
Let's look at a slightly smaller problem. A = zeros(10); numElements = numel(A) numDesired = ceil(0.25*numElements) elements...

4 years ago | 1

Answered
Can't import matlab.engine for python on M1 MAX chips after I successfully installed the matlab engine.
The page for the MATLAB R2022a Native Apple Silicon Platform Open Beta states, in part, that "MATLAB Engine API for Python is no...

4 years ago | 0

Answered
How to create answers to a calculation in an array in a forloop ?
Use discretize to generate the index vector then pass those index / group indices into groupsummary as the grouping variable and...

4 years ago | 0

Answered
How are propagation points connected?
The plot function connects the points you specify with straight lines. As the number of points you plot increase the curve looks...

4 years ago | 0

Answered
Warning: Imaginary parts of complex X and/or Y arguments ignored.
You probably want to recheck your units, do some dimensional analysis. Note that at the top of the Y axis that 1 unit on the Y a...

4 years ago | 1

Answered
Creating a variable that denotes a range of values
x = 4*rand(10, 1); edges = (0:0.05:4); y = discretize(x, edges, 'categorical'); results = table(x, y) Or if you want more co...

4 years ago | 0

| accepted

Answered
why I get the error "function 'lsqcurvefit' not supported for code generation" when using Matlab Coder?
Not all functions in Optimization Toolbox support being converted to C or C++ code using MATLAB Coder. In the most recent releas...

4 years ago | 1

Answered
One hop nearest neighbor in a graph
Find the neighbors of the node in the undirected graph then compute the distances between the specified node and its neighbors. ...

4 years ago | 1

Answered
Attempt to grow array along ambiguous dimension. How to fix?
This error occurs when you try to assign to an element beyond the last of a matrix but it's not clear what size the resulting la...

4 years ago | 1

Answered
how to average a vector of arrays in Matlab
Concatenate them in the third dimension then call mean with the dimension input. M = magic(4) E = eye(4) N = ones(4) C = {M,...

4 years ago | 0

Answered
Change Node & Edges position on Plot
See the "Adjust Properties of GraphPlot Object" example on this documentation page for a demonstration of how to set custom node...

4 years ago | 0

| accepted

Answered
Date and times logic
Let's say you had some sample dates with time components. rng default d = datetime(2022, randi(12, 10, 1), randi(31, 10, 1), r...

4 years ago | 0

| accepted

Answered
Sum block not giving proper output
Even if both the inputs of sum block are having same value as 2 From the result you described apparently the signals are not bo...

4 years ago | 0

Answered
Plot x^2+y^2=4
Another way to do this is to use the fcontour function. f = @(x, y) x.^2+y.^2; fcontour(f, 'LevelList', 4) axis equal If you...

4 years ago | 0

Answered
How to make 3 arrays (Test , Test2, Test3) that are of different lengths into one matrix?
Pad. For simplicity I'm assuming the variables you want to concatenate are vectors, but the general idea is the same if you want...

4 years ago | 1

Load more