Answered

How to repeat loop until condition is met? While or For Loop?

Something like this would be a good solution: x = %Initialization A = x + 1.5; B = x^2 + 1; Error = A-B; iter = 1; while ...

How to repeat loop until condition is met? While or For Loop?

Something like this would be a good solution: x = %Initialization A = x + 1.5; B = x^2 + 1; Error = A-B; iter = 1; while ...

5 dagen ago | 0

| accepted

Answered

Differentiating gives wrong result

I don't know why the result is presented in different way depending on the case, but the result is allways the same: %Case 1 s...

Differentiating gives wrong result

I don't know why the result is presented in different way depending on the case, but the result is allways the same: %Case 1 s...

7 dagen ago | 0

| accepted

Answered

Array indices must be positive integers or logical values

You are trying to acces to: B(0), B(0.1) and so on, which are not allowed indexes. Try with this: %% MAGNETORQUER SIZING clear...

Array indices must be positive integers or logical values

You are trying to acces to: B(0), B(0.1) and so on, which are not allowed indexes. Try with this: %% MAGNETORQUER SIZING clear...

7 dagen ago | 0

| accepted

Solved

Back and Forth Rows

Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...

10 dagen ago

Solved

Pizza!

Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

10 dagen ago

Solved

Make the vector [1 2 3 4 5 6 7 8 9 10]

In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

10 dagen ago

Answered

How can I find consecutive digits seperated by spaces?

An alternative without regexp: a = '1 1 1 4 4 6 7 7 7 7'; b = str2num(a); d = [true, diff(b) ~= 0, true]; n = diff(find(d))...

How can I find consecutive digits seperated by spaces?

An alternative without regexp: a = '1 1 1 4 4 6 7 7 7 7'; b = str2num(a); d = [true, diff(b) ~= 0, true]; n = diff(find(d))...

10 dagen ago | 3

Answered

How to identify and remove element if it is consecutively repeated a certain amount of times in an array

Following Jan's answer in this threat (link): A = [1 2 3 3 3 3 5 6 2 8 7 3 3 2]; d = [true, diff(A) ~= 0, true]; n = diff(fi...

How to identify and remove element if it is consecutively repeated a certain amount of times in an array

Following Jan's answer in this threat (link): A = [1 2 3 3 3 3 5 6 2 8 7 3 3 2]; d = [true, diff(A) ~= 0, true]; n = diff(fi...

12 dagen ago | 0

| accepted

Answered

How to run an if statement in a cell?

A possible soution: sol = cellfun(@(in) in > 0.1*mean(in(:)),A,'uni',0); %where A is your cell array

How to run an if statement in a cell?

A possible soution: sol = cellfun(@(in) in > 0.1*mean(in(:)),A,'uni',0); %where A is your cell array

14 dagen ago | 1

| accepted

Answered

Find sum of individual matrix of a given array of matrices and store it in a temporary array

Being M your matrix: sol = sum(sum(M,3),2)

Find sum of individual matrix of a given array of matrices and store it in a temporary array

Being M your matrix: sol = sum(sum(M,3),2)

14 dagen ago | 1

| accepted

Answered

How to divide a 4500x4500 matrix into smaller 36x36 matrices?

Try this: a = rand(4500); b = mat2cell(a,36*ones(4500/36,1),36*ones(4500/36,1))

How to divide a 4500x4500 matrix into smaller 36x36 matrices?

Try this: a = rand(4500); b = mat2cell(a,36*ones(4500/36,1),36*ones(4500/36,1))

17 dagen ago | 1

| accepted

Answered

Checking the variable for specific string

function [Y] = butter2filtfilt(x, Fs, Fcutoff, Type) if ~ismember(Type,{'high','low'}) error ('Filter type error') end ...

Checking the variable for specific string

function [Y] = butter2filtfilt(x, Fs, Fcutoff, Type) if ~ismember(Type,{'high','low'}) error ('Filter type error') end ...

19 dagen ago | 3

| accepted

Answered

[Help] Undefined function or variable 'Reference'. On Running a .m script file.

The name of your script "Reference-EPD-Project-v4" is not a valid name for a function/script. Are you sure that this is the name...

[Help] Undefined function or variable 'Reference'. On Running a .m script file.

The name of your script "Reference-EPD-Project-v4" is not a valid name for a function/script. Are you sure that this is the name...

19 dagen ago | 0

| accepted

Answered

How can I break this while loop and store the data?

Try with this: n = 7; iter = 1; seq(1) = n; %where the sequence is stored while n > 1 if mod(n, 2)==0 n = n/2;...

How can I break this while loop and store the data?

Try with this: n = 7; iter = 1; seq(1) = n; %where the sequence is stored while n > 1 if mod(n, 2)==0 n = n/2;...

19 dagen ago | 1

| accepted

Answered

Create new variable using if function from existing array variables

Try this: PMIdata.AboveMA = PMIdata.PMInum > PMIdata.PMIave;

Create new variable using if function from existing array variables

Try this: PMIdata.AboveMA = PMIdata.PMInum > PMIdata.PMIave;

20 dagen ago | 0

Answered

how to find complex polynomial solution

Then, after defining all the constant values: syms w CDP1 = T_6*(1i*w).^6 + T_5*(1i*w).^5 + T_4*(1i*w).^4 + T_3*(1i*w).^3 + T_...

how to find complex polynomial solution

Then, after defining all the constant values: syms w CDP1 = T_6*(1i*w).^6 + T_5*(1i*w).^5 + T_4*(1i*w).^4 + T_3*(1i*w).^3 + T_...

20 dagen ago | 0

Answered

saving with variable name

function myfun(filename,C) save([filename '.mat'], 'C'); end

saving with variable name

function myfun(filename,C) save([filename '.mat'], 'C'); end

20 dagen ago | 0

| accepted

Answered

could anyone please help me solve the matrices with respect to the equation as follows:

For i == 3: X3 = V(3)*U(2)-U(2)*sum(V(1:2))

could anyone please help me solve the matrices with respect to the equation as follows:

For i == 3: X3 = V(3)*U(2)-U(2)*sum(V(1:2))

20 dagen ago | 0

| accepted

Answered

How can I fill between two curves, but only when one curve is above the other?

You can do a little trick: plot(x,y1,'k',x,y2,'k:'); hold on; xlim([x(1) x(end)]); y1tmp = y1; y1tmp(y1<y2) = y2(y1<y2); j...

How can I fill between two curves, but only when one curve is above the other?

You can do a little trick: plot(x,y1,'k',x,y2,'k:'); hold on; xlim([x(1) x(end)]); y1tmp = y1; y1tmp(y1<y2) = y2(y1<y2); j...

24 dagen ago | 0

| accepted

Answered

Why my 'bboxes' and 'scores' variables are all empty while certainly my image contains a person?

Have you tried changing the peopledetector properties? For example, you get a result just changing the model: peopleDetector = ...

Why my 'bboxes' and 'scores' variables are all empty while certainly my image contains a person?

Have you tried changing the peopledetector properties? For example, you get a result just changing the model: peopleDetector = ...

26 dagen ago | 0

| accepted

Answered

Solving Equations with inputs from an Excel file

I suspect you have an overdetermined system (1 variable and 24 equations). Probably you want this: %% Energy balance Top layer ...

Solving Equations with inputs from an Excel file

I suspect you have an overdetermined system (1 variable and 24 equations). Probably you want this: %% Energy balance Top layer ...

27 dagen ago | 0

| accepted

Answered

Retrieve commands from .mat file

.mat files only store variables from the workspace. To retrieve command history: https://es.mathworks.com/matlabcentral/answer...

Retrieve commands from .mat file

.mat files only store variables from the workspace. To retrieve command history: https://es.mathworks.com/matlabcentral/answer...

27 dagen ago | 0

Answered

Remove duplicate rows in CSV file

Since all is numeric data, you can use: data = xlsread('kdd.xlsx'); datanew = unique(data,'rows');

Remove duplicate rows in CSV file

Since all is numeric data, you can use: data = xlsread('kdd.xlsx'); datanew = unique(data,'rows');

27 dagen ago | 1

| accepted

Answered

How do I make a new folder and then name it using the string stored within a variable.

Use: mkdir(s2)

How do I make a new folder and then name it using the string stored within a variable.

Use: mkdir(s2)

28 dagen ago | 0

Answered

Plot array of x ,y both in 2 columns, got unexpected multiple line result.

Just one line is ploted. See this: % plot_array_result_in_multiple_line.m load('X.mat','X'); load('Y.mat','Y'); h = plot(log...

Plot array of x ,y both in 2 columns, got unexpected multiple line result.

Just one line is ploted. See this: % plot_array_result_in_multiple_line.m load('X.mat','X'); load('Y.mat','Y'); h = plot(log...

ongeveer een maand ago | 0

| accepted

Answered

Interpolation of zero values in matlab

Try this: (Note that "cat" is not a good variable name because it is a Matlab function) [cat,nocat]=min(Animals); %readings fr...

Interpolation of zero values in matlab

Try this: (Note that "cat" is not a good variable name because it is a Matlab function) [cat,nocat]=min(Animals); %readings fr...

ongeveer een maand ago | 0

| accepted

Answered

Find equal rows between cell array and matrix into for loop

A = [ -0.11 7.17 3.66 -0.09 3.45 1.55 -0.21 2.17 9.87 -0.14 4.88 6.66]; B = {[-0.09 3.45 1.55],[-0.14 4.88 6.66...

Find equal rows between cell array and matrix into for loop

A = [ -0.11 7.17 3.66 -0.09 3.45 1.55 -0.21 2.17 9.87 -0.14 4.88 6.66]; B = {[-0.09 3.45 1.55],[-0.14 4.88 6.66...

ongeveer een maand ago | 0