Answered
Go around matrices/vectors columns
Here's one way, which is generalized in that it will work for other polygons besides pentagon, but it assumes the vertices are g...

2 years ago | 1

| accepted

Answered
Help extracting data from 3D matrices
Here's one way: A = cat(3,[1 0; 0 0],[0 2; 0 0],[0 0; 3 0]); v = [2;3]; [m,n,l] = size(A); idx = sub2ind([m,n,l],repelem(1...

2 years ago | 0

| accepted

Answered
Code to check for open uifigures
This will find all the uifigures you have open and store them in the variable f. Then you can delete them or whatever you want. ...

2 years ago | 0

Answered
for loop keeps putting out error
You have defined a variable called size, which means that the next time the code tries to use the built-in size function (i.e., ...

2 years ago | 0

Answered
How to create tiledlayout grid in vertical order
Set up variables: n_rows = 3; n_cols = 2; n = n_rows*n_cols; data = (1:n)+zeros(10,1); Default tiledlayout order, for r...

2 years ago | 1

Answered
My calculation for respiratory rate shows the same bpm for my 3 waveforms.
You are calculating the average of the inverse of the differences of t, but t is essentially just a vector of all time indices: ...

2 years ago | 0

Answered
Detrending data changing matrix size
Do you mean this? DFRT.data(1:128,:) = detrend(DFRT.data(1:128,:));

2 years ago | 0

Answered
How to make all the .tif files with the same size?
min_sz = min(sz,[],1); for ii = 1:N files(ii).data = files(ii).data(1:min_sz(1),1:min_sz(2)); end

2 years ago | 1

| accepted

Answered
Unable to perform assignment because the left and right sides have a different number of elements. Error in Assignment1Motorbike (line 139)
The culprit is this line: x_rd = vb * diff( sin(Q) ); Q is a scalar, so sin(Q) is a scalar, so diff(sin(Q)) is empty, so x_rd ...

2 years ago | 0

| accepted

Answered
resize matrix based on indices
input_file = 'logfile_example-30-09-23 .xlsx'; output_file = 'trials_2_5_7_10_only.xlsx'; ids = [2 5 7 10]; id_column = 3; ...

2 years ago | 0

| accepted

Answered
rename txt file within a specific folder
folder = dir('C:\...\...\...\*.txt'); % file_name = 'test.txt'; final_file_name = 'analysis.txt'; for id = 1 p = folder(...

2 years ago | 0

Answered
Matlab divides with the same value in every iteration
You are overwriting the variable y on each iteration of the loop. for i = 2:5 % ... y=x/(pi*D(i)^2./4); % ... e...

2 years ago | 0

| accepted

Answered
Remove missing entries from nested cell array
% make a cell array of string arrays with some missing elements: str = ["some",missing,"string"]; C = repmat({str},1,3) % rem...

2 years ago | 0

Answered
How Can I stored previous result with new or current result in same cell array?
Instead of initializing to empty the variables you plan to populate in the base workspace, try to get them from the base workspa...

2 years ago | 0

Answered
How to append text and numbers into a title
start_month_ISI=12; start_day=1; mth = month(datetime(1, start_month_ISI, 1), 'Name'); % To get the name of the month title({...

2 years ago | 1

Answered
Convert char to table
If you have a char vector like this, coordinates = '[446 154;445 155;444 156;443 156;442 156]'; disp(coordinates) then one wa...

2 years ago | 0

Answered
Too many output arguments error
writematrix doesn't return any outputs. Just say: writematrix(A, 'M.xls') What do you intend to be stored in B?

2 years ago | 0

| accepted

Answered
How to search for a index to a variable with known size
% some variables: a = rand(2,3,4); x = 4; simTimeData = zeros(226411,1); % size to look for: size_to_find = [226411,1]; ...

2 years ago | 0

| accepted

Answered
I want to collect data to cell array in Matlab App Designer.
Here is an app that collects data entered into two numeric editfields into matrix, and also performs some calculations and store...

2 years ago | 0

| accepted

Answered
how do I find the x-axis value from my yline intercept on my acceleration curve
% some data: tout = (0:60).'; yout = 10*log(tout+1); y_val = 26.8224; % your plot: P1 = plot(tout,yout(:,1),'linewidt...

2 years ago | 0

| accepted

Answered
why does it not plot the function?
Each iteration of the for loop, you are overwriting the value of R_P, so after the loop R_P is a scalar (i.e., it only has one e...

2 years ago | 1

Answered
fprintf formatting problem with cell and array matrix 3
You just have to tranpose data as well: data = [a; b].'; Full code: clear, clc, close all %% input data fracs = ... [1...

2 years ago | 0

| accepted

Answered
Error while evaluating UIControl Callback. Trying to get old code to work
The Callback of the C.Type popupmenu is defined as the following character vector: 'alc=get(C.panel(1),''Children''); for i=1:l...

2 years ago | 0

| accepted

Answered
adding all fields of a structures
Here's one way to do that: % a structure like your "my_struct", but with only 3 fields: my_struct = struct( ... 'bin_1',a...

2 years ago | 1

Answered
Why does exportgraphics not fully work, when using yyaxis?
Why does exportgraphics not fully work, when using yyaxis? I don't know why, but plotyy (not recommended) seems to give the cor...

2 years ago | 1

Answered
Upper limit on the number of UIAxes children allowed
Consider updating the XData, YData, and ZData of an existing line, rather than creating a new line each time you want to add mor...

2 years ago | 0

| accepted

Answered
vertical line on x axis
x = 3; y = interp1(a1,x1,x); line([x,x],[0,y])

2 years ago | 1

| accepted

Answered
horizontal boxplot with data dots on it and different colors
%% Learning rate clc; clear all; close all y1 = [1.06 1.1 0.89 0.96 0.95 1 0.76 1.41 0.97 0.75 0.83 0.76 0.79 1.31 1.08 0.83]'...

2 years ago | 0

| accepted

Answered
Convert two cell arrays (time values and data values) to one cell array of timeseries
AA = cellfun(@(dd,tt)timeseries(dd,tt),Y,t,'UniformOutput',false);

2 years ago | 1

| accepted

Answered
How to generate three figures to fill the screen (distributed vertically)?
The Position of a figure does not take into account the height of the menu bar or tool bar inside the window (if any), nor the h...

2 years ago | 0

Load more