Answered
Why is there no plot on my figure?
albedo = ((1-g)*t)./(2+(1-g)*t); % ^------ missed it

7 years ago | 0

Question


Why does connection error pops up?
Whenever I try to connect Matlab with arduino I get : >> a=arduino Failed to open a connection at serial port /dev/cu.usbmodem...

7 years ago | 1 answer | 0

1

answer

Answered
How to extract 1st digit of each number in an array
out=cellfun(@(c)c(1),""+x)-'0'

7 years ago | 0

| accepted

Answered
Why will I get below error? What might be the error?
plot(3*sin(2*pi*t+pi/2),'.-k')

7 years ago | 0

| accepted

Answered
Create a frequency table with the available number
t=tabulate(...); t(~all(t,2),:)=[]

7 years ago | 1

| accepted

Answered
how can i solve such two problems in single script file and run them?
https://www.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html

7 years ago | 0

Answered
Code not working?
[max_height,idx]=max(height); % ^^^---- gives the index , you were rying to index with value instead of true index t...

7 years ago | 0

| accepted

Answered
Can we get a free license for MATLAB for a specific competition
You need to Contact Mathworks Sales by clicking the Contact Us button on the top right corner of this page for what you are look...

7 years ago | 0

Answered
Error: Unable to perform assignment because brace indexing is not supported for variables of this type
STRGT=cell(1,nRow); % before the loop ,also move STRAIGHT outside the loop

7 years ago | 1

| accepted

Answered
Select the indexes corresponding to the n lowest values in a vector.
[Values,Indices]=mink(vector,n)

7 years ago | 0

| accepted

Answered
How can I specify a tolerance for data written in two text files?
Sounds like homework: 1) Load the files assign it to a variable x and y. 2) Use it in the formula. 3) Use max() to find the m...

7 years ago | 0

Answered
How to plot a polynomial of which I have coefficient vector?
fplot(poly2sym(a)) % where a is coefficients of a polynomial

7 years ago | 5

Answered
Subtract each number from each other in vector
new_vector=-diff(vector) %or new_vector=vector(1:end-1)-vector(2:end)

7 years ago | 0

| accepted

Answered
Replace regular expression in file name
str='/home/directory1/subs' if strcmp(str(end),'/') return else expp='$' str=regexprep(str,expp,'/','emptymatch') end

7 years ago | 0

Answered
Plot a variable with different values at different time intervals.
Logical indexing is more efficient : t=0:.001:8; r=zeros(size(t)); r(t>=0 & t<1)=100; r(t>=1 & t<4)=250; r(t>=4 & t<6)=330...

7 years ago | 1

| accepted

Answered
Selcting elements of a vector with index NOT in a specified index vector
A(setdiff(1:numel(A),index))

7 years ago | 0

| accepted

Answered
Dummy y axis?
doc yyaxis

7 years ago | 0

Answered
matrix with all possible combinations of 8!
See https://www.mathworks.com/matlabcentral/answers/442258-what-is-the-fastest-and-most-elegant-way-to-calculate-permutations-of...

7 years ago | 0

Answered
Error using * Inner matrix dimensions must agree.
See https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.htmlhttps://www.mathworks.com/help/matlab/mat...

7 years ago | 0

Answered
function with unspecified unknown variable?
doc solve

7 years ago | 0

Answered
Making elements in an array zero
a(~any(a,2),:)=[]; % where a is your matrix a(:,~any(a))=[]

7 years ago | 1

| accepted

Answered
Editing a cell array.
C={'1ms' '1kA' '10V' '2ms' '2.2kA' '3V' '3ms' '3.6kA' '5.4V'}; Matrix=str2double(cellfun(@(x)regexp(x,'^(...

7 years ago | 0

Answered
Remove all elements that occur more than once in a vector
Input = [1,2,2,3,4,1,5,2,7]; x = sort(Input); ii = [ find(x(1:end-1) ~= x(2:end)) length(x) ]; l = diff([ 0 ii ]); v = x(ii)...

7 years ago | 1

| accepted

Answered
Deleting Entries in an Array
A(~any(A(:,9),2),:)=[]

7 years ago | 0

Answered
Index exceeds the number of array elements (1). Error in HW08_Spaceship (line 34) xT =(5*(cos(45)+B(T+Kone)*sin(T)/2+sin(45)+B*(T+1/Kone)*cos(T))) >>
Suspect it should be sind() and cosd() ?: R= 40; Xo= 125; B = 42; Kone = 5; T = 0:30; % v---------...

7 years ago | 0

Answered
searching an array for a value embedded in a string
The below code can extract the numeric digit/s equated to Pan Scale: r=cellfun(@(x)regexp(x,'(?<=Pan Scale.{0,10})\d{0,10}\.?\d...

7 years ago | 0

Answered
Vector length must be the same
tRange = [0,300]; concA0=1.2; concB0=0.2; concC0 = 1.2; concD0 = 1.2; concE0 = 1.2; Y0=[concA0;concB0]; X0=[concC0;concD0;c...

7 years ago | 1

| accepted

Answered
Error dividing polynomials in plot
You just have to put ./ instead of / , it’s called element wise operation in MATLAB see https://www.mathworks.com/help/matlab/ma...

7 years ago | 0

Answered
How can I remove a specific number of elements from a cell array and place them into another cell array?
Don't think of dynamically naming variables use cells instead: A=mat2cell(b,1,[1 2 3 4]); celldisp(A)

7 years ago | 0

| accepted

Answered
Inner matrix dimensions must agree
.*

7 years ago | 0

| accepted

Load more