Answered
2 x 2d histograms from hist3
Let's say you had this 2-dimensional histogram. xy = [1 1; 1 1; 1 1; 1 -1; 1 -1; -1 1; -1 1; -1 -1]; histogram2(xy(:, 1), xy(:...

5 years ago | 0

Answered
How can I set a global variable in public properties App Designer that depends on another one?
When defining properties' default values, you can only use the values of other properties if those properties are Constant. To a...

5 years ago | 0

| accepted

Answered
problem in matlab for sin and cos
Since t and d are vectors I would create a 3-D array instead of a wide matrix. First turn t and d into 3-D arrays. t = reshape(...

5 years ago | 1

Answered
can someone explain to me this code line by line cuase im lost, i know the point of it but i cant figuret out
That would seem to be a question for the person from whom you obtained the code. If it's code from a textbook for a class you're...

5 years ago | 0

Answered
From discrete dates to continuous dates (revised)
Here's a sample timetable. dt = datetime(2020, 1, [1; 5; 12]); T = timetable(dt, [100; 40; 300], 'VariableNames', "visitors");...

5 years ago | 0

| accepted

Answered
For Loops with Multiple Arrays
m = [1:1:11]; r = [1:1:100]; z = [0:1:50]; whos The variable m is a 1-by-11 vector. The variable z is a 1-by-51 vector. What...

5 years ago | 0

Answered
Keep on getting 'Error using plot, Vectors must be the same length'. How can I plot it correctly?
Looking at a portion of your code with other parts cut out: % snip while h_check >= -0.5 % snip a(i+1)= - ...

5 years ago | 1

Answered
Array dimensions not consistent
%differential equations dcdt = [ (CA0-C(1))/tau -(-rA); (CR0-C(2))/tau+rR ; (CS0-C(3))/tau + rS]; The space before t...

5 years ago | 0

| accepted

Answered
please <<how can i define the inputs of this algorithm to matlab script ? also i dont know how to code line 5?
MATLAB script files do not and cannot accept input arguments. MATLAB function files can. See this documentation page for informa...

5 years ago | 0

Answered
Change logical operator of a while loop depending on value outside of the loop
for x = [1 2] if x == 1 compare = @gt; % > else compare = @lt; % < end if compare(2, 3) ...

5 years ago | 0

Answered
Getting x for a given y value from a cfit object
x = 2*rand(20, 1); y = 1.25*sin(x+0.3+rand(size(x))); f = fit(x, y, 'sin1') desiredy = 0.75; fun = @(x) desiredy - f(x); de...

5 years ago | 0

Answered
I have a homework assignment to create a final course grade calculator
Right now, the only place you assign a value to the QuizScore variable is inside the for loop that runs from 1 to the number of ...

5 years ago | 0

| accepted

Answered
triangle edges , triplet
function myList = rightTriangleEdges(listOfIntegers) clear all; close all; clc; These three commands should IMO almost never a...

5 years ago | 0

Answered
Find regular numbers 2^i 3^j 5^k
You cannot create functions by copying and pasting the code starting with the function keyword at the prompt in the Command Wind...

5 years ago | 1

Answered
How to use fwrite with a format subject to change
Since you're already storing your data in a table array, why not just use writetable?

5 years ago | 0

Answered
Lowess smoothing disappears in Curve Fitting App
According to this documentation page lowess is supported for surface fitting, not curve fitting. So if you specify x, y, AND z d...

5 years ago | 0

| accepted

Answered
Undefined function 'minus' for input arguments of type 'function_handle'. Error in flow1d2phase (line 46) Sw_shock = fzero(@(Sw)(dfw(Sw)-(fw(Sw0)-fw(Sw))./(Sw0-Sw)), 0.5);
Se = @(Sw)((Sw-Swc)/(1-Swc-Sor)); dSe = 1/(1-Swc-Sor); krw = @(Sw)0.5*(Se).^(6)+0.03*Se; There are a couple places where you ...

5 years ago | 0

Answered
How to align two columns each with their own time
Read your data into two timetable arrays then synchronize them. See the "Create Timetables" and "Resample and Aggregate Data in ...

5 years ago | 0

| accepted

Answered
Convert a value into a Matlab syntax string
mat2str([1 0 0;0 1 0;0 0 1]) But if you're doing this so you can later on evaluate this text to define the variable, I would ad...

5 years ago | 1

Answered
Cannot find builtin function 'waitbar'
The builtin function is intended to call built-in functions, not functions implemented by MathWorks as function files with the ....

5 years ago | 0

| accepted

Answered
How can I mark specific indexes on a plot?
You could use the MarkerIndices property of the line object returned by plot or you could use xline depending on how you want th...

5 years ago | 0

Answered
Unrecognized method, property, or field 'vertices' for class 'triangulation'.
The stlread function's documentation page states it returns a triangulation object. The documentation page for triangulation ind...

5 years ago | 0

| accepted

Answered
Define a name of the variable using the value of other variable
M = repelem(["January"; "February"], 2, 1); D = [1; 7; 1; 3]; V = [100; 50; 400; 200]; T = table(M, D, V, 'VariableNames', ["...

5 years ago | 0

Answered
How to find is between values for 1min datetime delta
Your datetime array may not display the date data but it includes date data nonetheless. d = datetime('now') d2 = d; d2.Format...

5 years ago | 1

Answered
some meshgrid and matlab.chart.graphics errors
Q=[1 2 3;4 5 6;7 8 9]; S=[0;1;2]; u1=linspace(-10,10,20); u2=linspace(-10,10,20); u3=linspace(-10,10,20); [U1,U2,U3]=meshgr...

5 years ago | 0

Answered
How can I save a list of open m-files?
This wasn't an option when the question was asked originally, but you may want to create a Project to manage your files.

5 years ago | 0

Answered
Create a String Array
Like this? c = 'A':'E' s = string(c') M = s + (1:6)

5 years ago | 0

| accepted

Answered
Using sigma notation when index is included in fucntion
There's no need to use symsum here. The sum function will be sufficient. A = diag([1 2 4 8]) D = eig(A) s = sum(1./D) % The ....

5 years ago | 0

Answered
How can I access a field of a struct, if I have a cell-Array containing all the subfields?
data.car.speed = 10; data.car.color = 'white'; data.duration = 1000; data.format = 'A4' pathToField = {'car', 'speed'}; S =...

5 years ago | 1

| accepted

Answered
Error using odeset "Not Enough Input Arguments"
[t,Y] = ode45(@(t,X) rocket(t,X),tspan,ini,change); Based on the error message, change is a local function (a subfunction) insi...

5 years ago | 0

| accepted

Load more