Answered
Extract specific hour data from timetable
I assume that's 8AM to 4PM inclusive. Here's one way: T = readtimetable('T.xlsx'); disp(T) % original tod = timeofday(T.tim...

2 years ago | 0

| accepted

Answered
For a known number of plots on the same axis, how do I set the colourscale?
data = (1:100).'+(1:20); n_lines = size(data,2); colors = jet(n_lines); figure colororder(colors); plot(data)

2 years ago | 0

| accepted

Answered
Is it possible to use the 'patch' function to display missing intervals in only one of the graphs created with the given code?
EDIT to include OP's data, which I missed initially. EDIT to include a patch face for missing data at the start or end of a fil...

2 years ago | 2

| accepted

Answered
Multiplying two variables in a table together
T.Power = T.Voltage.*T.Current; where T is your table.

2 years ago | 1

| accepted

Answered
How to make a loop end when you reach the end of some data
counter = 0; for ii = 1:numel(data) if condition counter = counter+1; end end

2 years ago | 0

Answered
How to determine if an axes already has a colorbar?
There is a hidden axes property called 'Colorbar', which you can use. % two axes, one with colorbar, one without ax = subplot(...

2 years ago | 1

| accepted

Answered
pérdida de colormap despues de activar y desactivar eje Y secundario en appdesigner
From the "Tips" section of the yyaxis documentation: "To clear the active side, use cla. To clear both sides of the axes and re...

2 years ago | 1

| accepted

Answered
How to Add Border to Single Color Region in pcolor Plot
load TestData [m,n] = size(medianVarianceAll2); [X,Y] = meshgrid(1:m,1:n); figure h = pcolor(X',Y',medianVarianceAll2); c...

2 years ago | 1

| accepted

Answered
Why between(datetime1, datetime2) is different from (-1)*between(datetime2, datetime1)?
From the between documentation: "In general, t2 is not equal to t1 + dt, unless you include 'time' in components."

2 years ago | 1

Answered
Matlab error how to fix?
"creating a m by 2 matrix where the first column is a datetime and second column is numeric" You cannot mix data types in a mat...

2 years ago | 0

Answered
Non-numerical data is still being loaded onto table. Need advice.
Note that the table returned by readtable is stored in app.dataTable before it's checked for non-numeric variables, so other par...

2 years ago | 0

| accepted

Answered
Solving an array without for loops
permute might be useful. Example: Array_1 = rand(3,10); % size of Array_1: [3, 10] Array_2 = rand(3,15); % size of Array_2: [3...

2 years ago | 0

Answered
Unable to display uicontrol within a given panel?
"checkbox1 = uicontrol(ax2, ...)" won't work because an axes cannot be the parent of a uicontrol, as the error message said. "...

2 years ago | 0

Answered
Fill area between two lines
It looks like xxO is a row vector and envelopeminO and envelopesupO are column vectors (any other combination would work properl...

2 years ago | 2

Answered
Circular shifting or rotating structure of array elements
A 1x3 array of structures: S = struct('x',{4 20 5},'y',{8 24 15}) S.x S.y 1. Shift the third element to first one using circ...

2 years ago | 0

| accepted

Answered
Circular shifting or rotating structure of array elements
A structure of arrays: S = struct('x',[4;20;5],'y',[8;24;15]) S.x,S.y 1. Shift the third row to first one using circshift: S...

2 years ago | 0

Answered
How to use for loop and get the result for each index varian?
"after running, it only gives the last model's result" Of course, because Optimizevalue is overwritten on each loop iteration. ...

2 years ago | 0

| accepted

Answered
Multiple Uses of UIMENU
"there seems to be a lot of duplicity. Is there a more elegant way to ahcieve this" Multiple components (e.g., uitables) can ...

2 years ago | 0

| accepted

Answered
How to adjust color of each bar in a grouped bar plot?
% data = [F_CRPS_ip A_CRPS_ip; F_CRPS_is A_CRPS_is; F_CRPS_rho A_CRPS_rho]; data = rand(3,2); y = data; x = ["I_P" "I_S" "...

2 years ago | 0

| accepted

Answered
Program not generating 0 as expected to turn variable cell to double
newZ1 = Z2*ceil(Z1/Z2); That makes each element of newZ1 the lowest multiple of Z2 greater than or equal to the corresponding e...

2 years ago | 0

| accepted

Answered
It keeps giving me an error on my xlim and the graph that it gives me isn't complete
xlim should be specified as a 1x2 numeric vector of increasing values, e.g., xlim([0.3 1]); not as a character vector (with s...

2 years ago | 1

| accepted

Answered
How can I modify the following code to send data row by row instead of column by column using UDP?
"I have data with five columns" I assume that's the variable data in your code. You can write data by row the exact way you ar...

2 years ago | 0

Answered
How to send Table using UDP in MATLAB
According to <https://www.mathworks.com/help/instrument/udpport.write.html the documentation>, the "data" input is: "Vector...

2 years ago | 0

Answered
Importing data to 3D array in matlab
Since each file has a different number of x,y, it'll be more convenient to use a cell array: Data = cell(1,nfiles); for ...

2 years ago | 0

| accepted

Answered
How to save a text file with number and text information?
Put the filenames in cell arrays. Example: lat1=1.2; lat2=3.2; long1=-44; long2=-34; grd='map.grd'; fault='fault.txt'; % fi...

2 years ago | 0

| accepted

Answered
quiver plot on an image
"Is there any way to superimpose quiver plot on imshow function?" Yes. % read an image: img = imread('peppers.png'); % imsho...

2 years ago | 0

| accepted

Answered
How to display rectangle ROI that was loaded from a file?
You can set the saved rectangles' parent to be a different/new axes. Example: % plot some rectangles: xlim([0 1]) ylim([0 1]...

2 years ago | 0

| accepted

Answered
How to get a bar plot with unequal bin intervals?
bin_edges = [0 5 20 100]; % include the last edge (100) bar_heights = [20 10 30]; bar(bin_edges,[bar_heights(:); 0],'histc') %...

2 years ago | 0

| accepted

Answered
How to change colors in my legend that is classified into three intervals?
Try storing the line handles returned from the m_plot calls, and then use those line handles in the legend call. That fixed the ...

2 years ago | 0

Answered
add element in table
% load stuff from the mat files: d1 = load('matlab_d1.mat','d1').d1; ff = load('matlab_ff.mat','ff').ff; d1 ff Name in ta...

2 years ago | 0

| accepted

Load more