Answered
Set color to 'none' instead of white in 'heatmap'
Unfortunately 'none' is not a valid value for 'MissingDataColor', and I cannot find any way to set alpha values in heatmaps. Wo...

6 years ago | 0

Answered
(app designer) Callback for ROIMoved event does not work
Thomas, When setting up the listener, use addlistener(ROI, 'ROIMoved', @app.allevents) Then, when defining allevents, use fu...

6 years ago | 5

| accepted

Answered
Dimensional error while running the code from matlab documentation
This code should run without error in R2016b and later due to implicit expansion, as t is a row vector and [50 150 200]' is a co...

6 years ago | 0

| accepted

Answered
Merge cell that has common element
I'm not sure if this is the best way to do it, but I believe it will work. It starts by setting A_new to A. It then loops throu...

6 years ago | 0

| accepted

Answered
Generating arbitrary colored tick labels
Is TeX an option for you? n=10; plot(1:n); labels = cell(n,1); for i=1:n labels{i} = sprintf('\\color[rgb]{%f, %f, %f}%...

6 years ago | 1

| accepted

Answered
How to check whether a specific variable is empty or not in table type
T_data(~cellfun(@isempty, T.ls_max_tone),:) This will return a table containing only the rows where ls_max_tone is not empty.

6 years ago | 0

| accepted

Answered
There is no InnerPosition property on the matlab.graphics.layout.TiledChartLayout class.
It looks like a handful of properties for TiledChartLayout objects, including 'Position', 'InnerPosition', and 'OuterPosition', ...

6 years ago | 1

Answered
How to get linprog to not ignore x0 R2019a
This suggests the initial condition is ignored unless you use the active-set algorithm. This says active-set was removed for li...

6 years ago | 0

Answered
find elements which has minmum and maximum probability in an array
A = [ 1,2,3,4,5,6,7]; P = [ 0.01,0.01,0.25,0.2,0.25,0.09,0.19]; minprob = A(P==min(P)) maxprob = A(P==max(P)) minprob = ...

6 years ago | 1

| accepted

Answered
How can I make this code more efficient so it will run faster?
Since the order of the steps doesn't matter, how about this? X = [1000, 2500, 10000, 25000, 100000, 1000000]; for k = 1:length...

6 years ago | 1

| accepted

Answered
Conditional replacement of array values from another array
Do you need a loop? If you know there are exactly as many 500s in A as there are values in B: A(A==500) = B; If there may be ...

6 years ago | 1

Answered
find maximum value for each year in a 2 columns array
Try this: [G, y] = findgroups(input(:,1)); output = [y splitapply(@max, input(:,2), G)];

6 years ago | 1

| accepted

Answered
Create a vector from components of old vectors
For a matrix A such as A = rand(3,5); this should work: v = [A(1,:) A(:,3)']

6 years ago | 1

| accepted

Answered
print values in one matrix to another
Let me know if this works: length = [connectivity, zeros(total_elements, 4)]; for i = 1:total_elements length(i, [4 6]) =...

6 years ago | 0

| accepted

Answered
Outputting cell vectors that contain specific information help?
You can use the colon operator to generate a character vector containing each lower case letter in the alphabet: >> 'a':'z' an...

6 years ago | 0

| accepted

Answered
Matlab Code for the Gauss Legendre Quadrature
Have your vectors of weights be the same size as your vectors of locations, ordered so that corresponding weights and locations ...

6 years ago | 2

| accepted

Answered
how do i give the user the option to stop making an input? while loops program.
Check the value of grade immediately after the user inputs it, and only update count and x if the loop should continue: x = [];...

6 years ago | 0

Answered
8 digit double array to 1 digit double array
How about H_conv = num2str(H)-'0'

6 years ago | 0

Answered
index exceeds the number of array
Ah, ok. You flip between treating S1 as a vector containing the different stock prices (which it is in your new code) and as a s...

6 years ago | 0

| accepted

Answered
(Strain vs Stress Curve) to (Stress Vs Strain Curve) Switch My X-axis into Y-axis in my plot
plot (strain.normal,length(strain.normal),'b'); In this line, length(strain.normal) is a scalar, so nothing is plotted, simil...

6 years ago | 1

| accepted

Answered
Trying to extract numbers between bounds and counting them
Currently, your for loop only runs once, during which time k is equal to the entirety of x. By using for k = x(:,1)' or just ...

6 years ago | 0

Answered
multiple linear regression check
All of the loops can be avoided. If you have something like b=1:10; for i=1:numel(b) a(i)=2*b(i)+3; end you can always ...

6 years ago | 0

| accepted

Answered
Formating a table with unequal rows
How about this? load('matlab.mat'); C = unique([OutnbEmployees1.AlgPhrase; OutnbEmployees2.IrqPhrase; OutnbEmployees3.TunPhras...

6 years ago | 0

Answered
Modifying a Row Vector to Pair up Numbers
How about this? S1 = [ 4, 6, 3, 5, 1 ]; S2 = [ 3, 3, 1 ]; S3 = [ 2, 4, 7, 1 ]; C = {S1,S2,S3}; C2 = cellfun(@(s) 10*s(1:end-1...

6 years ago | 0

Answered
Joining a column from one table to another by id
If you know each ID in A is included in B exactly once, I believe this should work: A = [A rowfun(@(rn) B.N(strcmp(B.ID,rn)), A...

6 years ago | 0

Answered
How to change certain values of a column in a table depending on a certain time range ?
Try this: totalaggregated{TR,{'Total'}} = 0.75*totalaggregated{TR,{'Total'}};

6 years ago | 0

| accepted

Answered
Always show the error Function definitions in a script must appear at the end of the file.
When you create a script in MATLAB, all function definitions need to be at the end of the file. function Dp=fun1(t,p) y=p(1);z...

6 years ago | 0

Answered
Find repeated pairs of two variables
How about this? % examples weight = randi([70 74], 10, 1); height = randi([5 7], 10, 1); [~,i] = unique(findgroups(height,...

6 years ago | 0

| accepted

Answered
Invalid use of operator. "*"
Make sure the period is adjacent to the asterisk: y = cos(20*x).* exp(x.^2);

6 years ago | 2

| accepted

Answered
How to set UIAxes min and max lim for plot in app designer ?
Use ylim(ax, [minlim,maxlim]) instead.

6 years ago | 0

Load more