Answered
How to append matrices? For example, if I have a 3*3 matrix and a 1*3 matrix, how to append them such that the resultant is a 4*3 matrix?
a=[1 2 3;2 3 4;4 5 6]; b=[1 2 3]; c=[a;b] % 4 X 3 Gives: c = 1 2 3 2 3 4 4 5 ...

7 years ago | 0

Answered
Delete the specific raw from a mat file
c(cell2mat(c(:,3))>5,:) = [] % where c is your cell array

7 years ago | 0

| accepted

Answered
combine two cell in one string and compare it with pattern
>> c = {'Z20','20Ah','CATL'}; >> v = strcat(c(2),{' '},c(3)) v = 1×1 cell array {'20Ah CATL'} >> filename = "...

7 years ago | 0

| accepted

Answered
Matrix row swapping with respect to column
I have no idea why Kalyan is making an easy task really harder but here is what you want: Y = A; Y(:,[2,3]) = flip(Y(:,[2,3]))...

7 years ago | 0

Answered
convert milliseconds (ms) to seconds (s)
format longg ms / 1000 doc format

7 years ago | 1

Answered
Delete rows in matrix based on elements of the column vector
A(B==2,:) = []

7 years ago | 1

| accepted

Answered
How to use linear interpolation to fill gaps to generate a contour (closed surface)
"i am focusing only first and last column..." M = [0 0 0;... 0 0 3;... 0 3 3;... 3 3 3;... 0 0 0;... ...

7 years ago | 0

| accepted

Answered
Pythonのnp.whereと同じ動作をつくりたい
C = A==B

7 years ago | 1

| accepted

Question


How to learn classes?
This field is relatively new to me. If possible could anyone structurise (meaning just list down the topics), so that I could le...

7 years ago | 1 answer | 0

1

answer

Answered
Delete row with same value but in different columns
Wanted = unique(sort(matrix,2),'rows') %or perhaps you want: [~,idx] = unique(sort(matrix,2),'rows'); Wanted = matrix(idx,:)

7 years ago | 0

Answered
Help to plot a Surface plot of: z = y sin x - x cos y
[X,Y] = meshgrid(-5:.2:5); Z = Y .* sin(X) - X .* cos(Y); surf(X,Y,Z)

7 years ago | 0

| accepted

Answered
Increasing numerator and denominator of vectors
[0,(1:9) ./ (2:10)]

7 years ago | 0

| accepted

Answered
How to resize a matrix with zeros in between elements
Try this - will work for any size of A: A =[... 10 5 4 10 2 3]; [m,n] = size(A); B = zeros(n,(2*m+n)-2)...

7 years ago | 0

Answered
Error: ()-indexing must appear last in an index expression.
No loop is needed: R1=(t*(Dq./Dz)) ./ (Qa.*((Du./Dz).^2+(Dv./Dz).^2)); R2 = R1(:)

7 years ago | 0

| accepted

Answered
How to find the index of top k max values in the matrix
[~,idx]=sort(A,'descend'); B=idx(1:3) C=setdiff(idx,B)

7 years ago | 0

Answered
How to find all matrix elements that equals any value from a certain list without looping over the list elements
Wanted = A == valuesVec(:) %or Wanted = bsxfun(@eq, A, valuesVec(:)) % for versions <= 2016a % or For your last example Want...

7 years ago | 0

| accepted

Answered
Code for an equation
.*

7 years ago | 2

Answered
save in pdf format (figure matlab)
saveas(h,'filename','pdf'); % how about this?

7 years ago | 0

| accepted

Answered
How to fill a matrix with ones
A =[A; ones(1600-109,26)]; % size(A)

7 years ago | 1

| accepted

Answered
How can I get A1, A2, A3, .... , A50 matrix ?
A{k} = ... % A preallocated same as data

7 years ago | 1

Question


How to share a variable from one method to another method?
classdef Sample properties a b end methods function f1 = form1...

7 years ago | 1 answer | 0

1

answer

Answered
Create array of all zeros in simulink
Why not use a MATLAB function block?

7 years ago | 0

Answered
I cant get fprintf to work
Use %.2f instead of %s

7 years ago | 1

| accepted

Answered
How do I rearrange a matrix in a loop
No loops needed: a = num2cell(A,2); B = blkdiag(a{:})

7 years ago | 0

| accepted

Answered
how to add text to my plot
t=0:0.01:2*pi; s=1; P=(4*sin(2.*t).*exp(-(t/s).^2)+2).*(0<=t<pi/2)+... (4*sin(2.*t).*exp(-t/s)+2).*(pi/2<=t<=2*pi); pl...

7 years ago | 0

| accepted

Answered
If Statement Using Text in a Table
I have no idea why you need a loop ( https://in.mathworks.com/help/matlab/matlab_prog/access-data-in-a-table.html ): T=table({'...

7 years ago | 0

| accepted

Answered
How to do matrix multiplication?
https://in.mathworks.com/matlabcentral/answers/305306-explicitly-multiplication-of-matrices-using-for-loops

7 years ago | 0

Answered
Matrix row cell concatenation
b = reshape(arrayfun(@(x)polyval(a(x,:),10),... 1:size(a,1),'un',0),[],1); Wanted = cell2mat(b)

7 years ago | 1

Answered
Assign several ranges of an array to the same number.
f((t>1 & t<2) | ( t>2.5 & t<3.5) | (t>4 & t<5)) = .1

7 years ago | 1

Load more