Answered
Can someone explain why in this code f3 and f2 are equal to (1048576,2)?
The zeros function creates an array of the specified size where every element is 0. A = zeros(3, 4) % a 3-by-4 array where all ...

4 years ago | 1

Answered
Extract data from sequentially named tables
Based on your code, ladeknecht is a cell array each cell of which contains a struct array. Let's create such a sample object on ...

4 years ago | 1

Answered
Script stuck running forever
One obvious optimization relates to the section of code starting with this comment: %Adding this duplicate line of code so that...

4 years ago | 0

Answered
Faster 2D Interpolation?
How many times are you performing this interpolation? Are the old X and Y coordinates the same each time you perform the interp...

4 years ago | 0

Answered
How to automatically get the axis of a figure in Live Editor?
If you call the function that displays the image with an output argument, you can determine which figure contains that graphics ...

4 years ago | 0

Answered
compute the condition number of a very large sparse matrix
Take a look at the condest function.

4 years ago | 0

Answered
Without using randi inbuilt function
We don't distribute the source code for the randi built-in function. If you want to see it, start here.

4 years ago | 1

Answered
Clickable list of all text-pattern functions?
Expand the "Match Patterns" section on this documentation page listing all the functions in the Characters and Strings category?...

4 years ago | 0

| accepted

Answered
Creating a daily date vector
Based on your stated goal, I'd probably store the data in a timetable array and then use retime to change it to a 'daily' timeta...

4 years ago | 1

| accepted

Answered
Index in Positon 1 is invalid
MATLAB indexing is 1-based not 0-based. The first element / row / column / etc. of an array in MATLAB is element / row / column...

4 years ago | 1

Answered
I would like my code to allow the user to plot as many circles as they want until the user right clicks, if the circle plotted intersects any other circle it must change color
% Define a function to make a "circle" with random center and radius % A 1000-sided polyshape is a pretty good approximation m...

4 years ago | 0

Answered
Implementation .m file into Appdesigner troubleshot
Which of those lines, line 55 or 56, throws the error? Set a breakpoint on that line. Then depending on which line throws the e...

4 years ago | 1

| accepted

Answered
i want to make program that find prime number
MATLAB already has a function for this. See the isprime function.

4 years ago | 1

Answered
Finding a node in graph with most mutually adjacent nodes
G = digraph(false(10)); G = addedge(G, 1, [2 4 5 7 9]); G = addedge(G, 2, [3 5 7 10]); G = addedge(G, 3, [1 2 4 8 9]); G = a...

4 years ago | 0

Answered
What version of MATLAB software will support ros2?
See this Answers post and the documentation page for the ros2 function in ROS Toolbox (which was Introduced in R2019b according ...

4 years ago | 1

Answered
getting int16s that are stored in two uint8s
Use typecast, potentially along with swapbytes. x = [0xbe 0xef] % Sample data class(x) % Two 8-bit unsigned integers y = type...

4 years ago | 1

| accepted

Answered
Issue with sprintf () latex interpreter
a = 1; disp('Here''s how to include a single quote in a char vector') disp("Here's how to include a single quote in a string a...

4 years ago | 1

| accepted

Answered
Termination tolerance in fsolve
See the Tip at the top of this documentation page. I suggest you increase your tolerance value to something greater than eps.

4 years ago | 0

| accepted

Answered
How to generate random numbers with constraint?
Generate the numbers then call sort on the array. By the way, you don't need to use a for loop here. The rand function can gene...

4 years ago | 0

Answered
Histogram occurences per class
Let's make some sample data and plot the histogram using the 'integers' BinMethod. In this case each integer in my data set gets...

4 years ago | 0

| accepted

Answered
time date to datenum and datenum to datetime
I'm going to assume that you've imported this data into MATLAB as a string array or a cellstr with two columns. Since I don't ha...

4 years ago | 1

Answered
What does it mean to take the absolute of an complex number? And why is it always positive?
I think one potential source of confusion is that the abs of this particular complex number looks an awful lot like its real par...

4 years ago | 1

| accepted

Answered
Error using matlab.internal.math.interp1 The sample points must be finite.
Error in coolprop_tab.MoistAir.calcMoistHeatCool (line 783) tOut(:,i) = interp1(x(:,i),v(:,i),xq(:,i)); Set a ...

4 years ago | 2

| accepted

Answered
Python function to Matlab
As @Anagha Mittal and @Akanksha Shrimal have stated there is a function in Financial Toolbox called movavg. However I'd recomme...

4 years ago | 0

Answered
Calculate the distance between points in a large data set
John showed you one approach. Two others that come to mind are to use the hypot or vecnorm functions. % Sample data xy = rand(...

4 years ago | 0

Answered
MATLAB gives the integer value of subtraction when the difference between numbers is large.
What's the distance from the elements of b to the next larger number? b = 10^23 distance = eps(b) If you were to add 1 to b, ...

4 years ago | 0

Answered
MATLAB function run in 2021a producing graphics handles as unique doubles (pre-2014 behavior) rather than handle objects
Without seeing what you're doing I'm only guessing, but I suspect you're preallocating an array as a double array and assigning ...

4 years ago | 2

| accepted

Answered
Split matrix into square cells
Use the histcounts2 function.

4 years ago | 2

Answered
How to publish as pdf from command tab
To do this using the publish function use the codeToEvaluate name-value pair argument as shown in the "Generate HTML View of MAT...

4 years ago | 1

| accepted

Answered
how to draw contour plot
There are a couple potential problems here. Did you really mean to make x a 1-element vector or did you mean to go from 0 to 1 i...

4 years ago | 1

Load more