Communication through MATLAB is always better than arguing.

Answered

Repeat value/variable in one column based on variable in another column

c = {'CS1' '7' '7' '7' '7' 'CS2' '9' '9' '9' ... 'CS1' '7' '9' '7' '7' '7' '7' '7' 'CS1'}; ix = ~isnan(str2double(c)); ...

Repeat value/variable in one column based on variable in another column

c = {'CS1' '7' '7' '7' '7' 'CS2' '9' '9' '9' ... 'CS1' '7' '9' '7' '7' '7' '7' '7' 'CS1'}; ix = ~isnan(str2double(c)); ...

1 hour ago | 0

| accepted

Answered

Matrix with for cycle

Qbar = cell(N, 1); % preallocate properly for other variables also Qbar{ii} = ... inside loop

Matrix with for cycle

Qbar = cell(N, 1); % preallocate properly for other variables also Qbar{ii} = ... inside loop

4 hours ago | 0

Answered

How do I get the differential of Hermite polynomial function?

http://se.xl48.cn/matlabcentral/answers/606286-how-do-i-get-the-differential-of-hermite-polynomial-function#comment_1039...

How do I get the differential of Hermite polynomial function?

http://se.xl48.cn/matlabcentral/answers/606286-how-do-i-get-the-differential-of-hermite-polynomial-function#comment_1039...

5 hours ago | 0

Answered

Matlab array and matrices

<http://se.xl48.cn/company/newsletters/articles/matrix-indexing-in-matlab.html> Start with MATLAB On-ramp course.

Matlab array and matrices

<http://se.xl48.cn/company/newsletters/articles/matrix-indexing-in-matlab.html> Start with MATLAB On-ramp course.

15 hours ago | 0

Answered

Convert for loop to while loop

Initialise ii with 0 instead of 1. Otherwise you start it as 2 therefore when you reach 5 it gets incremented to 6 exceeding the...

Convert for loop to while loop

Initialise ii with 0 instead of 1. Otherwise you start it as 2 therefore when you reach 5 it gets incremented to 6 exceeding the...

1 day ago | 0

Answered

How to remove the swap vectors from a matrix?

[Original_matrix, c, ~] = unique(sort(matrix, 2), 'rows'); New_matrix = matrix(setdiff(1:size(matrix, 1), c), :)

How to remove the swap vectors from a matrix?

[Original_matrix, c, ~] = unique(sort(matrix, 2), 'rows'); New_matrix = matrix(setdiff(1:size(matrix, 1), c), :)

1 day ago | 0

Answered

Efficient way/best practice to slice array under a logical condition as well as other conditions

What you have is more efficient.

Efficient way/best practice to slice array under a logical condition as well as other conditions

What you have is more efficient.

2 days ago | 0

Answered

How to store functions in matrix or some way to define them by iterations?

x = 0 : .01: 1; u = x.^2 + 6*x - 7;

How to store functions in matrix or some way to define them by iterations?

x = 0 : .01: 1; u = x.^2 + 6*x - 7;

3 days ago | 1

| accepted

Answered

How to check if a column data is equal to any of a group of values?

clear sum Ind = sum(ismember(A, B), 2) %Or perhaps you need Ind = nnz(ismember(A, B)) %or fprintf('%d occurs %d times/s\n',...

How to check if a column data is equal to any of a group of values?

clear sum Ind = sum(ismember(A, B), 2) %Or perhaps you need Ind = nnz(ismember(A, B)) %or fprintf('%d occurs %d times/s\n',...

3 days ago | 0

Answered

Variable indexing for loop when vector is negative (Array indices must be positive integers or logical values)

a = @(x) 12 * x.^5; a(x)

Variable indexing for loop when vector is negative (Array indices must be positive integers or logical values)

a = @(x) 12 * x.^5; a(x)

3 days ago | 0

Answered

How to remove rows based on logical values in one column?

T = table2array(readtable('73(4)_interval.xlsx')); T(any(T==0, 2), : ) = []

How to remove rows based on logical values in one column?

T = table2array(readtable('73(4)_interval.xlsx')); T(any(T==0, 2), : ) = []

3 days ago | 0

Answered

How to do sum of array having decimal value?

clear sum h = [ 0.2 0.54 0.75 1.33 ]; sum(h(2 : end))

How to do sum of array having decimal value?

clear sum h = [ 0.2 0.54 0.75 1.33 ]; sum(h(2 : end))

3 days ago | 0

Answered

Accessing Table entries in MATLAB

http://se.xl48.cn/help/matlab/matlab_prog/access-data-in-a-table.html

Accessing Table entries in MATLAB

http://se.xl48.cn/help/matlab/matlab_prog/access-data-in-a-table.html

3 days ago | 0

Answered

Reshape and Modify a cell array

Bessere Version: V = reshape(Ubertragungsmatrix(:, end), [], 3, 2); V1 = squeeze(num2cell(V, [1, 2])); [Pu_tr, Pn_tr] = deal(...

Reshape and Modify a cell array

Bessere Version: V = reshape(Ubertragungsmatrix(:, end), [], 3, 2); V1 = squeeze(num2cell(V, [1, 2])); [Pu_tr, Pn_tr] = deal(...

3 days ago | 0

Answered

Reshape and Modify a cell array

Vielleicht? C = num2cell(reshape(Ubertragungsmatrix(:, end), 294/2, []), 1); C1 = num2cell(cellfun(@(x) {reshape(x, [], 3)}, C...

Reshape and Modify a cell array

Vielleicht? C = num2cell(reshape(Ubertragungsmatrix(:, end), 294/2, []), 1); C1 = num2cell(cellfun(@(x) {reshape(x, [], 3)}, C...

3 days ago | 0

| accepted

Answered

Use subscript and superscript in legend

legend(['$\overline{H}_{subscript}^' ... '{superscript}$'],... 'interpreter','latex')

Use subscript and superscript in legend

legend(['$\overline{H}_{subscript}^' ... '{superscript}$'],... 'interpreter','latex')

3 days ago | 0

Answered

What Dth stands for?

Dth stands for the row 2 , index it to the matrix and use sum().

What Dth stands for?

Dth stands for the row 2 , index it to the matrix and use sum().

4 days ago | 0

Answered

How to select specific string

Wanted = cell_array(contains(cell_array, "197701011"))

How to select specific string

Wanted = cell_array(contains(cell_array, "197701011"))

5 days ago | 0

Answered

Replacing n random zeros in a matrix with a specific nonzero value

X(randperm(numel(X), 10)) = 1

Replacing n random zeros in a matrix with a specific nonzero value

X(randperm(numel(X), 10)) = 1

5 days ago | 0

| accepted

Answered

How to calculate new column values by using present_value and present_value -1?

v(2:end) ./ v(1:end-1) I would suggest you to do MATLAB On-ramp Course.

How to calculate new column values by using present_value and present_value -1?

v(2:end) ./ v(1:end-1) I would suggest you to do MATLAB On-ramp Course.

5 days ago | 0

Answered

Issue fprint outputting an xyz matrix to a file

fid = fopen('test.txt' , 'w'); fprintf(fid, 'Create vertex x %.2f y %.2f z %.2f\n',data.') fclose(fid) Why not simply ...

Issue fprint outputting an xyz matrix to a file

fid = fopen('test.txt' , 'w'); fprintf(fid, 'Create vertex x %.2f y %.2f z %.2f\n',data.') fclose(fid) Why not simply ...

5 days ago | 0

Answered

Why am I getting invalid expression?

h = 34.869 ; c = 13.679 ; J2eV = 0.845 ; lambda = 800:6:854; E = ((h * c) ./ lambda) / J2eV ; compose("Energy in eV: %f", E...

Why am I getting invalid expression?

h = 34.869 ; c = 13.679 ; J2eV = 0.845 ; lambda = 800:6:854; E = ((h * c) ./ lambda) / J2eV ; compose("Energy in eV: %f", E...

5 days ago | 1

Answered

Why am I getting the error of "Array indices must be positive integers or logical values." in the f(x) line?

Why on Earth do you need a loop? x = -1.612 : 0.01 : -1.322 ; f = 8 * x.^3 - 2 * x.^2 - 15 * x + 11 ; g = -10 * x.^3 + 10 * x...

Why am I getting the error of "Array indices must be positive integers or logical values." in the f(x) line?

Why on Earth do you need a loop? x = -1.612 : 0.01 : -1.322 ; f = 8 * x.^3 - 2 * x.^2 - 15 * x + 11 ; g = -10 * x.^3 + 10 * x...

5 days ago | 0

| accepted

Answered

Ordinary Differential Equations using laplace transform and plotting

fplot(sol)

Ordinary Differential Equations using laplace transform and plotting

fplot(sol)

5 days ago | 0

Answered

Double integral with limits

f = @(y, x) exp(2*x).*(cos(y)); % order of integration was wrong g1= @(y) sin(y); q = integral2(f,0,pi,0,g1) % Using Symbo...

Double integral with limits

f = @(y, x) exp(2*x).*(cos(y)); % order of integration was wrong g1= @(y) sin(y); q = integral2(f,0,pi,0,g1) % Using Symbo...

5 days ago | 1

Answered

Function will not run or produce answers

Remove first 2 lines. Your function doesn’t need any input arguments. You must call a function not simply clicking the g...

Function will not run or produce answers

Remove first 2 lines. Your function doesn’t need any input arguments. You must call a function not simply clicking the g...

6 days ago | 0