Answered
Line colour of two y-axis plot
Set the LineStyleOrder and ColorOrder properties after selecting the Left/Right yyaxes y1data = magic(10); y2data = randi([-10...

6 years ago | 0

| accepted

Answered
how to add one colorbar for the whole figure with tiled layout?
To use one colorbar that represents the color values for each subplot, each subplot must use the same colormap and the same colo...

6 years ago | 8

| accepted

Answered
How to write a Loop to run a specific code to every table in a cell
I can't run your code but here are some feedback at first glance. First, always use correct indentation so that it's much easi...

6 years ago | 1

| accepted

Answered
Fail to convert string to a number
For those who are trying to recreate the problem, t = [' 3.93',char(160)]; One solution is to use a regular expression to ex...

6 years ago | 0

Answered
How can I scatterplot by group by the sign of the variable?
If you have the statistics and machine learning toolbox, g = sign(var1)==sign(var2); gscatter(x,y,g) If you do not have acc...

6 years ago | 1

| accepted

Answered
How to change the time format from AM/PM to UT?
Datetime values can be formatted to show only the time component but the time component cannot be separated from a date. To sho...

6 years ago | 1

| accepted

Answered
How to fill NaN's by averaging previous rows?
For matrix m % Create a 10x12 matrix with NaNs in col 12 m = randi(100,10,12); m(randi(10,1,7),12) = NaN; % Replace nans ...

6 years ago | 1

| accepted

Answered
Merge table rows having same values?
This solution uses fillmissing() to identify NaN values and replace them using the rules described in the question. Since the e...

6 years ago | 1

Answered
How to generalize this code?
Instead of removing columns from your table, keep the table all together (unless you have a really good reason not to). Check...

6 years ago | 1

| accepted

Answered
Strip duration row with time duration 00:00:00:000
I'm assuming the WeirdDuration data are duration values. This simple solution assumes that you want to eliminate all rows starti...

6 years ago | 1

| accepted

Answered
How to pass cell array as input to function
" I want to pass this cell array as input to a function and access the element inside" There are (at least) three interpretat...

6 years ago | 1

| accepted

Answered
How to split column of a table?
T = [omni(:,1), array2table(omni.Var2)]; % Specify VariableNames if you wish % T = [omni(:,1), array2table(omni.Var2,'Variabl...

6 years ago | 2

| accepted

Answered
apply cellfun for specified rows of each cell
rows is a cell array the same size and shape at a containing vectors of row numbers. a={[1;2;4;5;2;3];[3;2;1;4;5;9;4;1;2];[];[2...

6 years ago | 1

| accepted

Answered
function which calls M-File and set their variables
"Is it possible to write a function which first take 1 input from user and based on that open one of two M-Files ..." Yes. The...

6 years ago | 0

Answered
Create a legend that writes all variable names that I plot
Here's a demo you can follow. The steps are Wrap inputname() into an anonymous function in order to get variable names. Plo...

6 years ago | 2

| accepted

Answered
Creat blank cell, where data are missing and generate related date
Create a temporary table that contains the missing dates in column A and NaN values in Column B. Then merge the temporary table...

6 years ago | 1

| accepted

Answered
How can I extract a value from 2-d matrix based on the row and column indexes?
Define the targets variable and then run this on your data. The variable varAtTarget is your output. This finds the nearest ...

6 years ago | 0

| accepted

Answered
Plot vectors from the origin
plot([0 3], [0,4]) % x1 x2, y1 y2 % or quiver(0, 0, 3, 4) % x1 y1 x2 y2

6 years ago | 1

| accepted

Answered
Limiting the number of Matlab figure windows
"Is there some internal limit on figure windows that can be set" Not that I'm aware of. Matlab will crash when it reaches memo...

6 years ago | 1

| accepted

Answered
How can I use legend for plotting dynamically sized matrix?
Your loop is continuously overwriting the legend and only including the most recently plotted line. You actually don't need a l...

6 years ago | 1

| accepted

Answered
What does the Tilde (~) mean here in this code?
[M,I] = max(___) has two outputs. The first is the maximum value of the input and the second is the index of the maximum value....

6 years ago | 2

| accepted

Answered
i am getting an error "Matrix index is out of range for deletion" Please help
In this section, huruflist = dir(traindir); huruflist(1) = []; huruflist(1) = []; it's likely t...

6 years ago | 0

| accepted

Answered
How do I remove data points off legend
Specify the line objects to include in the legend by supplying their handles. h1 = plot(fittedmodel1); h2 = plot(fittedmodel2...

6 years ago | 0

| accepted

Answered
creating a sub date time array
This 2-step process is done in 1 line. Round the year of the datetime vector to the decade (1999 becomes 1990s) Use [G,ID] =...

6 years ago | 0

| accepted

Answered
Intersect, Compare two columns or two matrix and extract common information
Here's a demo you can follow. It identifies rows of a matrix 'data' where the value in column 2 exactly matches the value in co...

6 years ago | 0

| accepted

Answered
Correlate time-series
You can use vq = interp1(x,v,xq) to interpolate the temp data so that it has 160 values. Then use R = corrcoef(A,B) to compute ...

6 years ago | 0

| accepted

Answered
Minus table with another table
You have to specify the columns of each table. % Create two tables, each with 1 column and 5 rows T1 = table(randi(10,5,1),'V...

6 years ago | 0

| accepted

Answered
How to change only the LineStyle of the top curve?
Here are two options with slightly different outcomes. Option 1 Modify the upper line only Y = [1, 5, 3; 3, 2, 7; ...

6 years ago | 0

Answered
Index in a matrix into an equation
Check out this link. S = sum(A,dim)

6 years ago | 0

Answered
Need help flipping axis values
Instead of plotting plot(x,y) plot plot(y,x) If you're using a different plotting function, the main idea is to just switch...

6 years ago | 0

Load more