Answered

How can I find an specific value inside an array without using the find function?

You can use the max function with second output argument, applied to the logical array w>=10, in order to return the first index...

How can I find an specific value inside an array without using the find function?

You can use the max function with second output argument, applied to the logical array w>=10, in order to return the first index...

1 month ago | 0

| accepted

Answered

how to expand a Square matrix and reverse to its original form ?

Here's some code that generalizes the example for any n (size of original matrix), except this expands the matrix to size n^2-by...

how to expand a Square matrix and reverse to its original form ?

Here's some code that generalizes the example for any n (size of original matrix), except this expands the matrix to size n^2-by...

1 month ago | 1

| accepted

Answered

Find differences between 2 tables

If your tables are the same size and both contain all numeric data, then this would work: % create some tables: t1 = table([1;...

Find differences between 2 tables

If your tables are the same size and both contain all numeric data, then this would work: % create some tables: t1 = table([1;...

1 month ago | 0

Answered

Simulating pendulum with a for loop

Notice that in each iteration of your loop you plot one point: (A(i),B(i)). That's why only the end of the pendulum shows up. If...

Simulating pendulum with a for loop

Notice that in each iteration of your loop you plot one point: (A(i),B(i)). That's why only the end of the pendulum shows up. If...

1 month ago | 0

Answered

Bar figure helps with group on the x-axis

Like this? x = [1.2132312 5.3413413212]; vals = [1.12234 1.34234 0.52342741238 2.4132213 3.1231232 5.123123 8.123123;5.7933711...

Bar figure helps with group on the x-axis

Like this? x = [1.2132312 5.3413413212]; vals = [1.12234 1.34234 0.52342741238 2.4132213 3.1231232 5.123123 8.123123;5.7933711...

1 month ago | 0

Answered

Writing a long equation in MATLAB

There are a couple of errors with the parentheses: d = ((1/(gamma*(abar(t-1,1) - a(t-1,1))))*(1+(a(t-1,1)/(gamma*(abar(t-1,1) -...

Writing a long equation in MATLAB

There are a couple of errors with the parentheses: d = ((1/(gamma*(abar(t-1,1) - a(t-1,1))))*(1+(a(t-1,1)/(gamma*(abar(t-1,1) -...

1 month ago | 0

| accepted

Answered

Accessing and using struct array using vectorization

aa = vertcat(list_el{:,1});

Accessing and using struct array using vectorization

aa = vertcat(list_el{:,1});

1 month ago | 0

| accepted

Answered

Plot axis limits different between figure and print

What happens if you resize the figure before calling print()?

Plot axis limits different between figure and print

What happens if you resize the figure before calling print()?

1 month ago | 0

| accepted

Answered

How can I concatenate or merge cell in Array

A = [2 3 5; ... 6 7 6; ... 5 7 1]; C = num2cell(A,1) celldisp(C)

How can I concatenate or merge cell in Array

A = [2 3 5; ... 6 7 6; ... 5 7 1]; C = num2cell(A,1) celldisp(C)

1 month ago | 0

| accepted

Answered

find the index who have the max value in cell structure

ex1=[1 2 3]; ex2=[0 3 2]; for i=1:3 a(i).b = struct('ex1',ex1(i),'ex2',ex2(i)); end temp = [a.b]; posidx = find([tem...

find the index who have the max value in cell structure

ex1=[1 2 3]; ex2=[0 3 2]; for i=1:3 a(i).b = struct('ex1',ex1(i),'ex2',ex2(i)); end temp = [a.b]; posidx = find([tem...

1 month ago | 1

| accepted

Answered

how can I plot the following graph

nz = 50; nt = 7; z = linspace(0,3500,nz); F = max(0,1000+1000*sin(z(:)/500+(1:nt)*pi/2)+500*randn(nz,nt)); colors = jet(nt...

how can I plot the following graph

nz = 50; nt = 7; z = linspace(0,3500,nz); F = max(0,1000+1000*sin(z(:)/500+(1:nt)*pi/2)+500*randn(nz,nt)); colors = jet(nt...

2 months ago | 1

Answered

Identify duplicates in a matrix and keep the one with minimum value

A = [1500 12 1; 1500 10 2; 1500 11 3;1500 15.61 6;1500 17 5;1500 15.56 4;2000 12.08 8;2000 13 8;2000 12.12 7;1...

Identify duplicates in a matrix and keep the one with minimum value

A = [1500 12 1; 1500 10 2; 1500 11 3;1500 15.61 6;1500 17 5;1500 15.56 4;2000 12.08 8;2000 13 8;2000 12.12 7;1...

2 months ago | 1

| accepted

Answered

Interp1 question on excel data with multiple columns and blank/empty cells

% read the file: M = readmatrix('p_d_FlameSpeed.xlsx'); % construct a cell array of two-column matrices of d and p values %...

Interp1 question on excel data with multiple columns and blank/empty cells

% read the file: M = readmatrix('p_d_FlameSpeed.xlsx'); % construct a cell array of two-column matrices of d and p values %...

2 months ago | 1

| accepted

Answered

Lookup values in ranges of a table and copy a corresponding output value in another table

A = load('A') B = load('B') [~,idx] = ismember(B.Events.Lap,A.Events.Lap); result = A.Events(idx,:)

Lookup values in ranges of a table and copy a corresponding output value in another table

A = load('A') B = load('B') [~,idx] = ismember(B.Events.Lap,A.Events.Lap); result = A.Events(idx,:)

2 months ago | 1

| accepted

Answered

imread with new name

Instead of 50 different variables named ImageID_1, ImageID_2, etc., how about one variable (a cell array) that contains all 50 i...

imread with new name

Instead of 50 different variables named ImageID_1, ImageID_2, etc., how about one variable (a cell array) that contains all 50 i...

2 months ago | 0

| accepted

Answered

How do I get a value in a table with a known index?

data = readmatrix('22-08-2022_12-59-07_Results.txt'); data(47,3)

How do I get a value in a table with a known index?

data = readmatrix('22-08-2022_12-59-07_Results.txt'); data(47,3)

2 months ago | 0

| accepted

Answered

Create a 24x1 structure from three arrays

Assuming your arrays are time, nid, name, here's how you can make a table: % the three arrays you have: time = [27; 36; 42]; ...

Create a 24x1 structure from three arrays

Assuming your arrays are time, nid, name, here's how you can make a table: % the three arrays you have: time = [27; 36; 42]; ...

2 months ago | 0

| accepted

Answered

Same values in matrix column

Here is a way: m = [1 2; 1 5; 1 8; 2 4; 2 5]; [mm,~,jj] = unique(m(:,1)); n = numel(mm); result = [mm zeros(n,nnz(jj == mo...

Same values in matrix column

Here is a way: m = [1 2; 1 5; 1 8; 2 4; 2 5]; [mm,~,jj] = unique(m(:,1)); n = numel(mm); result = [mm zeros(n,nnz(jj == mo...

2 months ago | 0

| accepted

Answered

I am having trouble saving a value and calculating new values from it.

n = 180; a = zeros(1,n); b = zeros(1,n); e = zeros(1,n); a(1) = 20000; R = 0.06; r = R/12; z = amortization(a(1),R,n); f...

I am having trouble saving a value and calculating new values from it.

n = 180; a = zeros(1,n); b = zeros(1,n); e = zeros(1,n); a(1) = 20000; R = 0.06; r = R/12; z = amortization(a(1),R,n); f...

2 months ago | 0

| accepted

Answered

How to extract the data in a column with the information of another column

t = readtable('3kmFES_001a.xlsx') t_LR_F_Double = t(t.DoubleContact == 1,{'RIGHT_Fz_N_' 'LEFT_Fz_N_'})

How to extract the data in a column with the information of another column

t = readtable('3kmFES_001a.xlsx') t_LR_F_Double = t(t.DoubleContact == 1,{'RIGHT_Fz_N_' 'LEFT_Fz_N_'})

2 months ago | 1

| accepted

Answered

Deleting Elements in a Structure - Error Matrix Index is Out of Range

x.score = [98 75 22 75 29]; x.count = [1 2 3 4 5]; x.count<4 is a 1x5 logical array x.count<4 x(x.count<4) = [] would try to...

Deleting Elements in a Structure - Error Matrix Index is Out of Range

x.score = [98 75 22 75 29]; x.count = [1 2 3 4 5]; x.count<4 is a 1x5 logical array x.count<4 x(x.count<4) = [] would try to...

2 months ago | 0

| accepted

Answered

Making loop to create graphs

Something along these lines: folder = 'your\folder\path'; files = dir(fullfile(folder,'*.txt')); hold on for ii = 1:numel(...

Making loop to create graphs

Something along these lines: folder = 'your\folder\path'; files = dir(fullfile(folder,'*.txt')); hold on for ii = 1:numel(...

2 months ago | 0

Answered

Match two variables list

c = ["80ms,110ms", "110ms,140ms", "140ms,195ms", "195ms,250ms", "250ms,400ms", "400ms,550ms", "550ms,725ms", "725ms,900ms"] c_t...

Match two variables list

c = ["80ms,110ms", "110ms,140ms", "140ms,195ms", "195ms,250ms", "250ms,400ms", "400ms,550ms", "550ms,725ms", "725ms,900ms"] c_t...

2 months ago | 0

| accepted

Answered

How do I count the number of Functions in a Function Handle?

It sounds like you actually want to count the number of elements in the vector returned by your function handle, in which case y...

How do I count the number of Functions in a Function Handle?

It sounds like you actually want to count the number of elements in the vector returned by your function handle, in which case y...

2 months ago | 1

Answered

Explanation of this function

size(x,1) is the size the array x in the first dimension, i.e., the number of rows of x. Reference: https://www.mathworks.com/h...

Explanation of this function

size(x,1) is the size the array x in the first dimension, i.e., the number of rows of x. Reference: https://www.mathworks.com/h...

2 months ago | 0

Answered

How to select sections of signal using a for loop and waitfor?

I don't think waitfor is closing the figure. Perhaps the figure is closed by subsequent code not seen here, or maybe what you ar...

How to select sections of signal using a for loop and waitfor?

I don't think waitfor is closing the figure. Perhaps the figure is closed by subsequent code not seen here, or maybe what you ar...

2 months ago | 0

| accepted

Answered

How to format a series of filenames with different characters as endings?

Make unitletters a cell array, using {}, and fix your cellfun syntax: unitletters = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i...

How to format a series of filenames with different characters as endings?

Make unitletters a cell array, using {}, and fix your cellfun syntax: unitletters = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i...

2 months ago | 0

| accepted

Answered

How to sort all rows in one table based on one row from the table and another table

t1 = table( ... {'Mom';'Dad';'Sister'}, ... 'VariableNames',{'Names'}) t2 = table( ... {'Sister';'Mom';'Dad'}, ....

How to sort all rows in one table based on one row from the table and another table

t1 = table( ... {'Mom';'Dad';'Sister'}, ... 'VariableNames',{'Names'}) t2 = table( ... {'Sister';'Mom';'Dad'}, ....

2 months ago | 1

| accepted

Answered

Summation of all odd numbers from 1 to 451

The for loop iterates n times, so after it's done, S represents the sum of n terms, which is fine when d = 1, but when d > 1, th...

Summation of all odd numbers from 1 to 451

The for loop iterates n times, so after it's done, S represents the sum of n terms, which is fine when d = 1, but when d > 1, th...

2 months ago | 1