Answered

Exporting data from matlab to a excel with a special pathway

xlswrite(filename,Y1,1) xlswrite(filename,Y2,2) xlswrite(filename,Y3,3)

Exporting data from matlab to a excel with a special pathway

xlswrite(filename,Y1,1) xlswrite(filename,Y2,2) xlswrite(filename,Y3,3)

14 days ago | 0

Answered

How do I code a function that's supposed to be an infinite pattern?

Another possibility: res = sum(x.*circshift(y,-1) - y.*circshift(x,-1))

How do I code a function that's supposed to be an infinite pattern?

Another possibility: res = sum(x.*circshift(y,-1) - y.*circshift(x,-1))

14 days ago | 0

Answered

Best way to calculate the determinants of a series of matrices?

delta = arrayfun(@(t) det(squeeze(G(t,:,:))),1:size(G,1));

Best way to calculate the determinants of a series of matrices?

delta = arrayfun(@(t) det(squeeze(G(t,:,:))),1:size(G,1));

18 days ago | 0

Answered

what is the error in this program

There is no error in your code, the problem is that it doesn't do whatt you want. I guess you want something like this (without ...

what is the error in this program

There is no error in your code, the problem is that it doesn't do whatt you want. I guess you want something like this (without ...

18 days ago | 0

Answered

Errror using imwrite, can't use "append" in 'WriteMode'

You are changing the file name for each frame, resulting in different tif images. To build a tif stack you just need to use ONE ...

Errror using imwrite, can't use "append" in 'WriteMode'

You are changing the file name for each frame, resulting in different tif images. To build a tif stack you just need to use ONE ...

18 days ago | 1

| accepted

Answered

How to generate a random integer between two bounds?

randi([4,500])

How to generate a random integer between two bounds?

randi([4,500])

19 days ago | 0

| accepted

Answered

i want to plot 4 plots using ginput

Adding hold on: clear all; close all; hold on for k=1:4 axis([0,10,0,10]); data = ginput(4); x = data(:,1); y = data(:,2...

i want to plot 4 plots using ginput

Adding hold on: clear all; close all; hold on for k=1:4 axis([0,10,0,10]); data = ginput(4); x = data(:,1); y = data(:,2...

26 days ago | 0

| accepted

Answered

Summing up values of A matrix if it matches the same value in B

One option: [G,ID] = findgroups(B); C = [splitapply(@sum,A,G),ID] C = 15.0000 32.1111 3.0000 34.6731 1.0000...

Summing up values of A matrix if it matches the same value in B

One option: [G,ID] = findgroups(B); C = [splitapply(@sum,A,G),ID] C = 15.0000 32.1111 3.0000 34.6731 1.0000...

27 days ago | 0

| accepted

Answered

Problem in plotting the string variable

Do you mean this? Rough_y=[4;5;8;3;12;14;9;11;17;17;11;14;19;25;15] Station=['a';'b';'c';'d';'e';'f';'g';'h';'i';'j';'k';'l';'...

Problem in plotting the string variable

Do you mean this? Rough_y=[4;5;8;3;12;14;9;11;17;17;11;14;19;25;15] Station=['a';'b';'c';'d';'e';'f';'g';'h';'i';'j';'k';'l';'...

28 days ago | 0

Answered

How can i use Inverse for symbolic variables?

syms x y a b c d A = [ a*(x^2) , b*(y^3) ; d*(x^2)*y , c ]; inv(A) ans = [ c/(- b*d*x^2*y^4 + a*c*x^2), -(b*y^3)/(- b*d*x^...

How can i use Inverse for symbolic variables?

syms x y a b c d A = [ a*(x^2) , b*(y^3) ; d*(x^2)*y , c ]; inv(A) ans = [ c/(- b*d*x^2*y^4 + a*c*x^2), -(b*y^3)/(- b*d*x^...

1 month ago | 1

Answered

problem with reading data from excel

Do you mean this? data = xlsread('yourExcel.xlsx'); data = data(2:end,2:end) data(2,4) %For example: x1 = 2; x2 = 4

problem with reading data from excel

Do you mean this? data = xlsread('yourExcel.xlsx'); data = data(2:end,2:end) data(2,4) %For example: x1 = 2; x2 = 4

1 month ago | 0

| accepted

Answered

Checking for existence of row in a matrix

Try with this: my_mat = [1 2 4 5 3 1 6 9 7]; new = [6 9]; Lia = ismember(my_mat(:,1:2),new,'rows'); ...

Checking for existence of row in a matrix

Try with this: my_mat = [1 2 4 5 3 1 6 9 7]; new = [6 9]; Lia = ismember(my_mat(:,1:2),new,'rows'); ...

1 month ago | 0

| accepted

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 ...

1 month 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...

1 month 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...

1 month 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...

1 month 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...

1 month 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...

1 month 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))...

1 month 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...

2 months 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

2 months 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)

2 months 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))

2 months 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 ...

2 months 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...

2 months 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;...

2 months 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;

2 months ago | 0