How to replace last row of matrix with a vector?
Tutorial

5ヶ月 前 | 0

How do I calculate the average of TStep4 and TSTep2?
doc mean

5ヶ月 前 | 0

Create a 34 element column vector, PiVec, where every element is the irrational number pi
Use those commands and add/multiply with which number you want the elements to be. doc ones doc zeros

5ヶ月 前 | 0

making a random unique vector from 0 to 9999
doc randperm

5ヶ月 前 | 1

how to convert answer to one single number
f = @(x) 2.048*exp(-((x-5.056)/0.2349).^2) +... 1.089*exp(-((x-4.887)/0.4006).^2) +... 0.4116*exp(-((x-9.103)/5.731).^...

5ヶ月 前 | 0

| 採用済み

How to store the results from a for loop into a matrix?
F = 2; x = .1:.05:1.9; Reactions = cell(numel(x),1); b = [0 F 0 F/2 0 0 0 0 0 0]'; % there's no point in defining it over an...

5ヶ月 前 | 0

Apply function on array
Probably you're looking for cumsum() doc cumsum

5ヶ月 前 | 0

find index of a element present in matrix
[~,Z]=max(A,[],2)

5ヶ月 前 | 0

| 採用済み

Array indices must be positive integers or logical values
beta Operator missing here ( M Note: Don’t name a variable beta because there is an inbuilt function named *beta()*. Prealloc...

5ヶ月 前 | 0

insert zero in chosen column of matrix randomly
ix = 1:2:size(A,1); A(ix(randi(numel(ix),1)),3)=0

5ヶ月 前 | 0

| 採用済み

Possible matlab bug with text() function?
When you name variable as the same name as the function this happens. clear text plot sin % not sure which function you’re...

5ヶ月 前 | 0

| 採用済み

Swapping the columns based on matrix even length
No matter odd or even: ix=(2:2:size(matrix,2)) + [0;-1]; % if > 2016b ix = bsxfun(@plus, 2:2:size(a,2), [0;-1]) Wanted = matr...

5ヶ月 前 | 1

how to make a legend for a single point
h=plot(i,Cm_1212_voigt,'.g') % inside loop legend(h,'Points') % outside loop

5ヶ月 前 | 0

| 採用済み

Delete rows in intervall
An another alternative: ix = (5:7:size(TABLE,1)) + [0;1;2]; %if > 2016b ix = bsxfun(@plus, 5:7:size(TABLE,1), [0;1;2]) TABLE...

5ヶ月 前 | 0

| 採用済み

How can I take a mean of a matrix only from 10 first rows?
>> X = rand(50000,3); % are you sure it's a 50000 by 3 matrix? >> mean(X(1:5000,:)) ans = 0.5028 0.5015 0.4978 ...

5ヶ月 前 | 0

logical array variables in a loop
It would been simpler if they were stored in a cell array: c{1} = outlier & incl_p; c{2}= outlier & incl_r; c{3} = ou...

5ヶ月 前 | 1

| 採用済み

How can i get sub matrices with using for loop
a=arrayfun(@(x)A(A==unique(x)),A,'un',0) celldisp(a) If you’re goal is simply to create A with repetitions of 10 then it...

5ヶ月 前 | 0

How can I plot a sin (x^2) function
fplot(@(x)sin(x.^2),[-pi,pi])

5ヶ月 前 | 1

How to count the number of repeat elements in a matrix
M =["Fa" "Fa" "Fa" "Fa" "Ka" "Ka"]; [~,~,c] = unique(M); A = accumarray(c,1)

5ヶ月 前 | 0

| 採用済み

Create a matrix from a vector
A = ismember(M,V) .* M % Note: 14 should be in 1,1 not 2,1

5ヶ月 前 | 0

| 採用済み

Creating a table for publishing for the matrix I defined
TABle = table(T(:),C_vv(:),'VariableNames',{'Temperature','Heat'}) % I don’t know what you mean by naming columns isn’t that V...

5ヶ月 前 | 0

| 採用済み

How to use a nested loop to do a matrix calculation?
x = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16] y = [16 15 14 13; 13 14 15 16; 17 18 19 20; 21 22 22 23] v = zeros(k,l)...

5ヶ月 前 | 0

| 採用済み

Matlab Hw #1 help
doc colon doc rad2deg doc fprintf

5ヶ月 前 | 1

| 採用済み

How can I add a matrix into another matrix
A = [A;B] help fprintf doc fprintf

5ヶ月 前 | 0

Preallocated array A using a for loop
https://in.mathworks.com/help/matlab/matlab_prog/preallocating-arrays.html - you will see how to store values in each iteration...

5ヶ月 前 | 2

| 採用済み

How do i find the x value for a GIVEN x
fsolve(@(x)f(x)-.25,[0,10]) % two solutions but look into you're area of interest fplot(@(x)f(x)-.25,[0,11])

5ヶ月 前 | 0

How to select the values greater than the mean in an array?
B1(B1>mean(B1(:)))

5ヶ月 前 | 1

| 採用済み

Error using ^ inputs
.* .^ <https://in.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html>

5ヶ月 前 | 0

How to assign vectors to existing vector
newvector_2=vector_2; ix=nnz(~vector_2); v12=[vector_1,nonzeros(vector_2).']; u=unique(v12); d=setdiff(1:max(v12),v12); new...

5ヶ月 前 | 0

How to add two values to a matrix each five values of that matrix in order to have a new matrix?
ix=arrayfun(@(x)[x,x*(ones(~mod(x,5),2))],1:numel(XY),'un',0); % multiple of 5----^ ^-- n times idx=cat(2,ix{:...

5ヶ月 前 | 1