Answered
Generate all possible permutations including repeats
F = [0,1,2]; n_values = numel(F); n_combos = n_values^n_values; M = F(1+dec2base(0:n_combos-1,n_values)-'0'); disp(M);

2 years ago | 0

Answered
generate all possible upper triangular matricies with variables
g = [1,NaN,NaN; 0,1,NaN; 0,0,1]; v = [0,1,2]; n_values = numel(v); slots = find(isnan(g)); n_slots = numel(slots); n_...

2 years ago | 0

| accepted

Answered
Ordering a matrix as x increases and y increases
square = unique(square,'rows'); works to remove repeated rows, yes. In I uderstand the ordering you want, it is to sort by y-co...

2 years ago | 0

| accepted

Answered
Keyboard Shortcut to move through the tabs in a Tab Group menu (Request to improve code)
That code can be simplified a bit: % Window key press function: UIFigure function kpf(app, event) if ~isequal(event.Mod...

2 years ago | 2

| accepted

Answered
Problem substituting a for loop with vectorization
% just to have some values to run with: l1 = 1; l2 = 1; alfa1 = 0; alfa2 = 0; k1 = linspace(0,2*pi,360); k2 = linspace...

2 years ago | 1

| accepted

Answered
call function with fewer parameters
"what happen if i call function with 1 parameter instead of 3" The answer depends on what the function does with the parameters...

2 years ago | 0

| accepted

Answered
restructure data table based on date and other categorical variables
T = readtable('data_test.csv') T_summary = groupsummary(T,{'Site','Date'},@(x){x},{'d18O','Depth'}); T_summary = removevars(T_...

2 years ago | 0

| accepted

Answered
How I can split a two column data into chunks like this snap shot
S = load('Data_Chunking.mat'); A = S.Alg2_mLat_maxEE; C = 9; % chunk size [M,N] = size(A); % in case A is not an integ...

2 years ago | 0

| accepted

Answered
Question about headerlines commend
Check why fopen in this line FID = fopen([DataFolder,'\',DataList(n)], 'r') returns -1 for FID. Better yet, use the second ou...

2 years ago | 0

Answered
Insert data to table
temps = table(datetime(rand(10,1),'ConvertFrom','datenum'),rand(10,1)) a_different_table = table([1;2;3;4;5]) start_row = 6; ...

2 years ago | 0

| accepted

Answered
duplicate tab:how know reference object?
Better than findobj() is to capture the output from copyobj(): new_obj = copyobj(obj,newtab);

2 years ago | 0

| accepted

Answered
tabs created in the tabgroup
numel(tg.Children) where tg is your tabgroup.

2 years ago | 0

| accepted

Answered
fprintf formatting problem with cell and array matrix 2
fracs = ... [1.080799513888714E-32 0 0.62466759170135333 0.0742119108820972 0 0 0 ... 0 0 0.30112049741654717; 8.1862...

2 years ago | 0

| accepted

Answered
check if tab exist
"i want check if app.Tab_Instrum_Aggreg exist or not" isprop(app,'Tab_Instrum_Aggreg')

2 years ago | 0

| accepted

Answered
how to extract slider's value
You are storing the slider object in an array. hslide is the array, and hslide(i) is the slider. When you try to get the value, ...

2 years ago | 0

| accepted

Answered
Clean data and extraction
T = readtable('data.xlsx'); T.Properties.VariableNames = num2cell(char(64+(1:size(T,2)))); % set H = G where H == 0 idx = T...

2 years ago | 0

| accepted

Answered
problem with columnWidth..how solve it
It seems like you are confusing the table data object with the uitable graphics object. If you have a uitable (UIT) whose data ...

2 years ago | 0

Answered
Is there a property to reset timer
I think stop() then start(), like you've done, is the best way.

2 years ago | 0

| accepted

Answered
How to only fill one line of a matrix with a given formula
function A = specialMatrix(n) A = zeros(3,n); A(1,:) = 1; A(2,1:2:end) = 20; A(3,1:3:end) = 30; ...

2 years ago | 0

Answered
How to get all unique positions in a cell array?
c = num2cell(unique(vertcat(c{:}),'rows'),2);

2 years ago | 0

| accepted

Answered
How do I identify elements in a table/matrix and sort them in descending order?
M = magic(5) % some matrix [v,idx] = sort(M(:),'descend'); [r,c] = ind2sub(size(M),idx); result = [r, c, v]

2 years ago | 1

Answered
How Do I Create a Mean Filtered Image using For Loops?
[gRow, gCol, ~] = size(grayImg); gRow and gCol are non-negative scalar integers. if mod(gRow, 3) < 3 mod(_,3) of something wi...

2 years ago | 1

| accepted

Answered
Interpolation on multiple data sets
Have you tried interpn? thrusts = 0.1:0.3:1; altitudes = 10000:1000:12000; mach_numbers = 0.25:0.1:0.75; [T,A,M] = ndgrid(...

2 years ago | 0

Answered
menu not showing elements in string array
menuOption = menu('Choose file.', savedFileNames{:}, 'Return to previous menu'); This passes the elements of savedFileNames as ...

2 years ago | 0

| accepted

Answered
extracting rows of data
inputFile = '07010000002.txt'; data = readmatrix(inputFile); figure hold on plot(data(:,1)) min_idx = find(islocalmin(d...

2 years ago | 1

Answered
How to iterate through a cell array and link elements in particle tracking?
This plots using only the "good" (i.e., non-zero) indices from Index_matrix{jj}. Note that three additional particle tracks are ...

2 years ago | 0

Answered
Given vector with N entries, generate all combinations with K entries such that K > N, vector entries can repeat
syms a b v = [a b]; n = numel(v); k = 4; result = v(dec2base(0:n^k-1,n)-'0'+1)

2 years ago | 0

Answered
Plotting piecewise function over two periods
t = 0:0.001:0.8; ih = zeros(size(t)); idx = t < pi/10; ih(idx) = 500*sin(10*t(idx)).^2; plot([t t+0.8],[ih ih])

2 years ago | 0

| accepted

Answered
How do you plot a line on a function defined by colors?
img = imread('image.png'); imagesc(img) hold on contour(mean(img,3),'k')

2 years ago | 0

Answered
fprintf formatting problem with cell and array matrix
See the attached modified script and resulting .txt file. The file-writing section is reproduced here: prodNums = length(prodN...

2 years ago | 0

Load more