5.674 total contributions since 2014

Suspensa Vix Via Fit

Answered

How can i compute the derivative of a signal in an instant of time/sample?

Use gradient.

How can i compute the derivative of a signal in an instant of time/sample?

Use gradient.

1 día ago | 0

Answered

getting Complex double in matlab while excel solves it

(1-exp(-(WL-0.26053)./0.15994)).^2.28411 % % ^^^^ ^ positive values (around 5) %^^^ ...

getting Complex double in matlab while excel solves it

(1-exp(-(WL-0.26053)./0.15994)).^2.28411 % % ^^^^ ^ positive values (around 5) %^^^ ...

1 día ago | 0

| accepted

Answered

1) I need a code to determine the intersection points, I have tried '==' is not working, also I would like to know if it is possible to make the grid line look like a graph sheet i.e using Xtick and Ytick

Use fzero to find the intersection of two functions. Method one: functions >> F1 = @(x)1.5*x-1; >> F2 = @(x)0.3*x; >> X = 0:...

1) I need a code to determine the intersection points, I have tried '==' is not working, also I would like to know if it is possible to make the grid line look like a graph sheet i.e using Xtick and Ytick

Use fzero to find the intersection of two functions. Method one: functions >> F1 = @(x)1.5*x-1; >> F2 = @(x)0.3*x; >> X = 0:...

1 día ago | 3

Answered

How to access induvidual elements in a string

The simplest and most efficient solution is to use sscanf: >> S = '23hrs 45min'; >> V = sscanf(S,'%fhrs%fmin') V = 23 ...

How to access induvidual elements in a string

The simplest and most efficient solution is to use sscanf: >> S = '23hrs 45min'; >> V = sscanf(S,'%fhrs%fmin') V = 23 ...

1 día ago | 0

Answered

Using a binary matrix as an index to select values from another matrix

>> X = [1,0;3.5,1;0,6]; >> p = [13,12;11,19;22,23]; >> p.*(X==1) ans = 13 0 0 19 0 0

Using a binary matrix as an index to select values from another matrix

>> X = [1,0;3.5,1;0,6]; >> p = [13,12;11,19;22,23]; >> p.*(X==1) ans = 13 0 0 19 0 0

2 días ago | 0

Answered

Executing .m files function in R2015b is not working properly

Ugh, invalid filenames and anti-pattern dynamic variable names... it seems that your task was explicitly designed to torture int...

Executing .m files function in R2015b is not working properly

Ugh, invalid filenames and anti-pattern dynamic variable names... it seems that your task was explicitly designed to torture int...

3 días ago | 0

| accepted

Answered

Check if any elements of cell array are equal ?

Matching: >> a{1}=[1,1,0]; >> a{2}=[9,9,9,9]; >> a{3}=[1,1,0]; >> a{4}=[]; >> N = numel(a); >> [X,Y] = ndgrid(1:N); >> Z ...

Check if any elements of cell array are equal ?

Matching: >> a{1}=[1,1,0]; >> a{2}=[9,9,9,9]; >> a{3}=[1,1,0]; >> a{4}=[]; >> N = numel(a); >> [X,Y] = ndgrid(1:N); >> Z ...

3 días ago | 2

| accepted

Answered

Code for Multiple Matrix Multiplication

>> T=randi(9,4,4,3); % fake data >> T(:,:,1)*T(:,:,2)*T(:,:,3) % your approach ans = 2359 1398 2072 2154 1788 ...

Code for Multiple Matrix Multiplication

>> T=randi(9,4,4,3); % fake data >> T(:,:,1)*T(:,:,2)*T(:,:,3) % your approach ans = 2359 1398 2072 2154 1788 ...

3 días ago | 0

| accepted

Answered

how xor is used between two no.? or which command ?

I suspect that you actually want to be using bitxor (and possibly also specify the classes): >> bitxor(mod(176+233,256),142) a...

how xor is used between two no.? or which command ?

I suspect that you actually want to be using bitxor (and possibly also specify the classes): >> bitxor(mod(176+233,256),142) a...

3 días ago | 1

| accepted

Answered

How to create legend from cell array?

Simply using one cell array: legend(itm{2}(1:4)) or using your approach of separate input arguments (character vectors): lege...

How to create legend from cell array?

Simply using one cell array: legend(itm{2}(1:4)) or using your approach of separate input arguments (character vectors): lege...

3 días ago | 1

| accepted

Answered

Extracting data from multiple structures in a .mat file

Do NOT load directly in the workspace. If you do that, then you will force yourself into writing slow, complex, buggy code by t...

Extracting data from multiple structures in a .mat file

Do NOT load directly in the workspace. If you do that, then you will force yourself into writing slow, complex, buggy code by t...

3 días ago | 1

| accepted

Answered

Create structure path from string and cell array

I already answered this in your last question: https://www.mathworks.com/matlabcentral/answers/466887-extracting-data-from-mult...

Create structure path from string and cell array

I already answered this in your last question: https://www.mathworks.com/matlabcentral/answers/466887-extracting-data-from-mult...

3 días ago | 0

Answered

how can I generate random decimal numbers in a specific decimal range?

v = [-2.96706,2.96706]; v(1)+diff(v)*rand(1,6)

how can I generate random decimal numbers in a specific decimal range?

v = [-2.96706,2.96706]; v(1)+diff(v)*rand(1,6)

3 días ago | 0

| accepted

Answered

How to delete numbers from cell?

Simpler with regexprep: >> D = regexprep(C,'^\S+\s*','') D = 'SPEED MEASURED 1 [rpm]' 'MOTOR SPEED [rpm]' 'MOTO...

How to delete numbers from cell?

Simpler with regexprep: >> D = regexprep(C,'^\S+\s*','') D = 'SPEED MEASURED 1 [rpm]' 'MOTOR SPEED [rpm]' 'MOTO...

3 días ago | 2

| accepted

Answered

To assign to or create a variable in a table, the number of rows must match the height of the table

You wrote a literal string instead of concatenating the variable data onto the end of the character vector. fullfile('C:\Users\...

To assign to or create a variable in a table, the number of rows must match the height of the table

You wrote a literal string instead of concatenating the variable data onto the end of the character vector. fullfile('C:\Users\...

4 días ago | 0

| accepted

Answered

Matlab is giving conflicting results, please help.

"...but Matlab still says they aren't equal?" Because they aren't equal. This is very easy to check (you already used one meth...

Matlab is giving conflicting results, please help.

"...but Matlab still says they aren't equal?" Because they aren't equal. This is very easy to check (you already used one meth...

4 días ago | 0

| accepted

Answered

How to read specific lines from a text file and store them in a matrix?

This code should work regardless of the number of rows or columns: opt = {'Headerlines',3, 'CollectOutput',true}; fid = fopen(...

How to read specific lines from a text file and store them in a matrix?

This code should work regardless of the number of rows or columns: opt = {'Headerlines',3, 'CollectOutput',true}; fid = fopen(...

4 días ago | 1

| accepted

Answered

How do I add an additional column to a cell array based on existing values in another column?

>> x = {'x1',1';'x2',2;'x3',1} x = 'x1' [1] 'x2' [2] 'x3' [1] >> x(:,3) = {0}; >> x([x{:,2}]==1,3) =...

How do I add an additional column to a cell array based on existing values in another column?

>> x = {'x1',1';'x2',2;'x3',1} x = 'x1' [1] 'x2' [2] 'x3' [1] >> x(:,3) = {0}; >> x([x{:,2}]==1,3) =...

4 días ago | 0

Answered

Why doesn't legend distinguish colors?

The problem occurs on this line: plot(t,ca,'r') Because t is a vector (with 501 elements) and ca is a scalar, then you are tel...

Why doesn't legend distinguish colors?

The problem occurs on this line: plot(t,ca,'r') Because t is a vector (with 501 elements) and ca is a scalar, then you are tel...

5 días ago | 0

| accepted

Answered

Building the Fibonacci using recursive

I doubt that a recursive function is a very efficient approach for this task, but here is one anyway: function v = myfib(n,v) ...

Building the Fibonacci using recursive

I doubt that a recursive function is a very efficient approach for this task, but here is one anyway: function v = myfib(n,v) ...

5 días ago | 0

Answered

How do I multiply an integer with a single value from the matrix?

You need to convert the character vector (contained in the output) into numeric, e.g.: C = inputdlg(...); % C is a cell array o...

How do I multiply an integer with a single value from the matrix?

You need to convert the character vector (contained in the output) into numeric, e.g.: C = inputdlg(...); % C is a cell array o...

6 días ago | 0

| accepted

Answered

When using the eval function, MATLAB doesn't recognize " , " as an ASCII character, rendering it useless

Evil eval strikes again! This is a very good example of how using eval results in slow, complex code that is buggy and hard to ...

When using the eval function, MATLAB doesn't recognize " , " as an ASCII character, rendering it useless

Evil eval strikes again! This is a very good example of how using eval results in slow, complex code that is buggy and hard to ...

6 días ago | 2

Answered

showing a colored matrix with colormap

imshow(nwmat,'DisplayRange',[],'Colormap',jet(64))

showing a colored matrix with colormap

imshow(nwmat,'DisplayRange',[],'Colormap',jet(64))

8 días ago | 0

| accepted

Answered

Nested Functions versus Global Variables

"Why are nested functions better for sharing variables between workspaces than global variables?" Nested functions provide much...

Nested Functions versus Global Variables

"Why are nested functions better for sharing variables between workspaces than global variables?" Nested functions provide much...

8 días ago | 3

| accepted

Answered

Can anyone please explain me this line of a code?

If audR is a matrix, then audR(audR(:,1)==x,2)==2 % ^^^^^^^^^ % first column of audR % ^^^ % ...

Can anyone please explain me this line of a code?

If audR is a matrix, then audR(audR(:,1)==x,2)==2 % ^^^^^^^^^ % first column of audR % ^^^ % ...

9 días ago | 3

| accepted

Answered

How can I get cell2struct to work within my for loop? "error using cell2struct, Number of field names must match number of fields in new structure"

Following the cell2struct documentation, if fields is a four-element cell array and dim is 1 then temp would have to be a cell a...

How can I get cell2struct to work within my for loop? "error using cell2struct, Number of field names must match number of fields in new structure"

Following the cell2struct documentation, if fields is a four-element cell array and dim is 1 then temp would have to be a cell a...

9 días ago | 0

Answered

How to find image size without imread and size(*,1)

Use imfinfo: info = imfinfo(...); info.Height info.Width

How to find image size without imread and size(*,1)

Use imfinfo: info = imfinfo(...); info.Height info.Width

10 días ago | 0

Answered

Is this a bug? And if not, why it is defined like that

"Is this a bug?" Not according to the MATLAB documentation: https://www.mathworks.com/help/matlab/matlab_prog/command-vs-funct...

Is this a bug? And if not, why it is defined like that

"Is this a bug?" Not according to the MATLAB documentation: https://www.mathworks.com/help/matlab/matlab_prog/command-vs-funct...

11 días ago | 3

Answered

Loading multiple (e.g. ~ 3000) mat files into workspace and merging them in a table

" i will need to list all 3000 variables from workspace.." That is a good example of why load-ing directly into the workspace i...

Loading multiple (e.g. ~ 3000) mat files into workspace and merging them in a table

" i will need to list all 3000 variables from workspace.." That is a good example of why load-ing directly into the workspace i...

11 días ago | 1

| accepted