Answered
How to extract a group of columns from a matrix using loop?
No loop is needed: Instead of naming variable dynamically(https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-v...

7 years ago | 0

Answered
copy and add elements and expand array
A=1:500; B=zeros(1,numel(A)+floor(numel(A)/2)); B(3:3:end)=A(2:2:end); B(setdiff(1:numel(B),3:3:end))=A

7 years ago | 2

| accepted

Answered
I need help with marking all fzeros in my plot.
f = @(x) sin(x); h = linspace(-1,11,5); % increases the instances of initial guesses xz=arrayfun(@(x)fzero(f,h(x)),1:numel(h))...

7 years ago | 1

Answered
ある時間の値(予測)
Just use interp1() (see the method it provides and adapt it to your needs): time = [0,0.64,1.28,1.92,2.56,3.2,3.84,4.48]; data...

7 years ago | 1

| accepted

Answered
How do I count occurrences of a variable in a vector and stop when I reaching a different variable?
https://www.mathworks.com/help/matlab/ref/regexp.html - read it to see more examples , however it takes some practice to get the...

7 years ago | 1

Answered
How to use function in the script of Matlab
It’s always a good idea to read the documentation: https://www.mathworks.com/help/matlab/matlab_prog/create-functions-in-files....

7 years ago | 0

| accepted

Answered
replacing values from a separate vector to multiple repeated values in another vector
index=find(x==0); idx=find(diff(index)~=1); z=x; z(z==0)=repelem(y,[idx(1) diff(idx) numel(index)-idx(end)]); z(z==1)=0

7 years ago | 1

| accepted

Answered
create a matrix with numbers from vector
Simpler: M = +(v==unique(v).')

7 years ago | 1

Answered
create a matrix with numbers from vector
v = [1 1 1 2 2 2 3 3 4]; u=unique(v); R=arrayfun(@(x)v==u(x),1:numel(u),'un',0); M=+vertcat(R{:}) Gives: M = 1 ...

7 years ago | 1

| accepted

Answered
Count the occurence of a number in between other numbers
index=find(x==0); % edited after Jan’s comment idx=find(diff(index)~=1); R=[idx(1) diff(idx) numel(index)-idx(end)]

7 years ago | 1

Answered
How do I repeat a column vector to make into one longer column vector?
repmat(yourvector,30,1) %or repelem(yourvector,30,1) % choose which suits you

7 years ago | 0

| accepted

Answered
Substract only higher then a limit? Please find the example program below.
https://blogs.mathworks.com/loren/2013/02/20/logical-indexing-multiple-conditions/ - this should get you started DataI_with_Neg...

7 years ago | 0

Answered
数値の予測方法
x=[1:5 NaN]; fillmissing(x,'linear') % likewise try it for your second example

7 years ago | 1

| accepted

Answered
2x/5-x/6=7/10
doc solve

7 years ago | 1

Question


Why the script file is not saved?
Whenever I try to save a script file for the first time after opening MATLAB the file does not save , I have to restart MATLAB t...

7 years ago | 0 answers | 0

0

answers

Answered
how can i export a numeric vector that starts from 0 eg. 0001 from matlab to excel?
Use xlswrite() or writetable().

7 years ago | 0

Answered
What is the exact reason of this error? I am not getting it. Any help will be appreciated.
Delete − and again add - .

7 years ago | 1

| accepted

Answered
Subtracting 1 matrix from several columns in a larger matrix
M(:,1:3) - N % ^^^---- represent three columns can be any three columns %M is of size 3553450x8 %N is of size 3553450x1...

7 years ago | 1

| accepted

Answered
How do I extract numbers from mixed data to create a table?
s={'190208:123346.128737 Tx:MOV x pos: 1668224µm prec: 2 acc: 0 mode: 00 id: 7056' '190208:123346.577784 Rx:MOV x status: 0 po...

7 years ago | 0

Answered
Inserting the mean of two numbers in the vector
a =[1 2 3 4 5 6 7 8 9] B=(a(1:end-1)+a(2:end))/2 a_new=zeros(1,numel(a)+numel(B)); a_new(2:2:end)=B; a_new(1:2:end)=a

7 years ago | 0

Answered
How do I make a vector where the entries are months and years?
t = (datetime(2006,1,1):calmonths(1):datetime(2012,12,31)).' t.Format='MMM-yyyy'

7 years ago | 0

Answered
exact multiplication of variable in equation
expand(prod(q))

7 years ago | 0

Answered
Convert .csv file to .mat file
T=readtable('mycsv.csv'); % ^^^^^^^^^------ your csv filename p=T{:,1}; q=T{:,2}; save('mymat.mat','p','q') % ...

7 years ago | 6

| accepted

Answered
how to use more than one color for the plot with respect to the code given below
Since I don't have the data : R=rand(150,1); % example data RR=reshape(R,25,[]); % reshape your data into 25 rows plot(RR)% ...

7 years ago | 0

| accepted

Answered
My equation in for loop with 180 iterations is only giving me one answer
If you insist loop then: anglei=90; a=linspace(0,180,180); T=zeros(size(a)); % look here for n=1:numel(a) t=((tan(angle...

7 years ago | 0

Answered
My equation in for loop with 180 iterations is only giving me one answer
You don't need a loop: anglei=90; a=linspace(0,180,180); t=(tan(anglei)-tan(a))./(tan(anglei)+tan(a)); plot(t,a)

7 years ago | 0

| accepted

Answered
Trying To Solve Symbolic Set of Equations, not sure What The Output Means
[c,xr,xb,c0]=vpasolve(eqs,unknowns) You can access the results using dot indexing or directly assign unkown outputs like above:...

7 years ago | 0

Answered
I need to use some function on iPad Pro
imgaussfilter() needs Image Processing Toolbox so you need a valid license to use it(after downloading).

7 years ago | 0

| accepted

Answered
Removing zero columns from matrix
matrix(:,any(matrix == 0))=[] % removes column if there is any zero in the column matrix(:,all(matrix == 0))=[] % removes colum...

7 years ago | 5

| accepted

Load more