Answered
Please answer! How to use an if function effectively?
colmn_analyze=4; % desired column to compare colmn_target=2; % desired column to set valLimit=2; % limiting val...

6 years ago | 1

| accepted

Answered
i cant able to plot graph of this cord
y=@(x)c1*exp(-diff(x))+d*(sin(x)/(d^2+1))+d^2*(cos(x)/d^2+1); numel(diff(x)) is one less than numel(x) so the above will fail...

6 years ago | 0

Answered
Is there a way to change the value of a variable within a function?
You can do anything you want inside the function as long as you can write a definition of what it is that is to happen. You cou...

6 years ago | 0

| accepted

Answered
How to delete the first word in each line in txt file?
Read the file into string or cellstr array and extractAfter() the blank. Not feasible to do on disk; don't even think of trying...

6 years ago | 0

| accepted

Answered
FilePath including a variable
Variables are variables, not text. rootdir="C:\Users\Desktop\Test\"; % use variable so can change easily filespec="*.txt";...

6 years ago | 0

Answered
Convert 1X5 to 3X3
Probably more clever ways, but N=3; % number elements to duplicate A=a(1:N); % first row for i=2:numel(a)-(N-1) A...

6 years ago | 0

| accepted

Answered
Function : undefined function or variable
"wrote a function fun in a "Vc.m" file" but the function function [Vc] = fun(j,b,m,R) Vc(j) = E0-b.*log(j)-R.*j-m.*exp(n....

6 years ago | 0

| accepted

Answered
question regerding the print
Don't really understand the question/confusion... Live Scripts or Live Functions are just that -- they exist and can run only i...

6 years ago | 0

| accepted

Answered
Problem Calling Data While Using Linear Regression Model 'fitlm'
"this is [p]ossibly due to the Species column being a string column..." That's exactly the problem. See Coding systems for ca...

6 years ago | 1

Answered
How can I use the unique function to output all the different numbers following M from all the file names?
rootdir = '/Users/apple/Desktop/Project/Code/Data/'; % good! Using variable so can change: +1 d=dir(fullfile(rootdir,'*_dat...

6 years ago | 0

Answered
function to calculate rows with non-missing data
Don't need to write any functions -- use ismissing and friends with, perhaps sum and maybe all, any could be of interest as well...

6 years ago | 0

Answered
Kindly help me to find error in attached code to find leap years for a range
isleapyr=@(yr) (eomday(yr,2)==29);

6 years ago | 0

| accepted

Answered
Preallocation of a vector of structure
You preallocated a double array and then tried to put a struct variable into it. As you discovered, "You can't do that!" There...

6 years ago | 0

Answered
How to cross 2 matrixes, one column at a time?
C=cross(A,B); Like most other functions in MATLAB, cross operates in a vector sense. cross operates by default on the first di...

6 years ago | 0

Answered
How to write a row of a matrix using if statement?
A=[ones(size(x1) x1 y1 x1.*y1]; B=[ones(size(x2) x2 y2 x2.*y2]; M=[A B]; Of course, numel(x1)==numel(x2) or all goes boom!

6 years ago | 0

| accepted

Answered
How would I remove certain values of an array and put it into another array?
function [microbeInd, noLifeInd] = semTest(semData) microbeInd = islocalmax(semData); noLifeInd=semData(~microbeInd); end...

6 years ago | 0

Answered
How to custom arrange a timetable
Well, that isn't all that is in the files.... >> tRaw=readtable('2019_Jan-Mar_DA_LMPs.csv'); >> head(tRaw) ans = 8×28 tabl...

6 years ago | 0

| accepted

Answered
Extract columns from matrix based on a vectors values
>> A=[1,1,1,0; 2,1,0,1]; B=[3,4]; >> A(:,B) ans = 1 0 0 1 >> B=[3,1]; >> A(:,B) ans = 1 ...

6 years ago | 0

Answered
trying to find an aproximate value in a data set
disp('I in (A), t in s, Idot in A/S') [Imax,Iloc] = max(I); tmax = t(Iloc); Idot_1 = Imax./tmax; disp([Imax tmax Idot_1]) I...

6 years ago | 0

| accepted

Answered
How does FindPeaks works?
TMW doesn't reveal innards beyond what is in documentation so the answer is "we don't know". What the documentation says is: "...

6 years ago | 0

Answered
fortran do loop to matlab
MATLAB is Fortran w/ DO --> for and CONTINUE --> end But, depending on what "somethings" are, you may well (and probably should...

6 years ago | 1

Answered
How to convert a table to a 2d array
Don't make a cell array of tables to start with... x=[]; for i=1:data.numberofselected concatenated=strcat(strcat(strcat(fi...

6 years ago | 0

Answered
How to cut out/delete rows in a cell
mu_mean_Mess_20kmh_HA=cellfun(@(c) mean(c(126:end,:)),mu_20kmh_all_VA); Don't need explicit loop; you just forgot the column co...

6 years ago | 0

Answered
Matlab Arrays not populating correctly
You've got a typo... population.Chromosomes(M).Gene(:) = [rand, 0]; is writing into the location M(=10) every time.

6 years ago | 1

Answered
can anyone please explain X0(1:2) where X0=[0,0,0]' , i wrote X0(2:2) and gave answer 0 i tht it shoudl give error . what i understand is X0(1:2) is 1 row 2 element. please correct me
Linear addressing. Arrays are stored in column-major order. See https://www.mathworks.com/help/matlab/math/array-indexing.html...

6 years ago | 0

Answered
Issues with power spectral density calculation of linear ramp
y=detrend(y);

6 years ago | 0

| accepted

Answered
Read from Excel file as a plain table
[~,~,r]=xlsread('yourfile.xls'); will return a cell array r that is a duplicate of the spreadsheet content with no interpretati...

6 years ago | 1

| accepted

Answered
SELECT SPECIFIC VALUES FROM AN ARRAY
Presuming from the above you have the cellstr array given, using the simplified string-matching functions, one solution would be...

6 years ago | 0

| accepted

Answered
How to select specific data from one matrix and place it in another
The following can be optimized, but if I understand you want the data reordered by hour for each day, then the basic idea for an...

6 years ago | 0

Answered
RMS value of non-sinosoidal current
r=rms(x);

6 years ago | 0

Load more