Answered
Why is readcell not functioning as expected?
If the creating and reading routines don't have some sort of semaphore arrangment to let the one know the file is closed it's po...

5 years ago | 0

Answered
Axis ticks and colorbar labels in bold (heatmap)?
Another case where TMW is too clever by far in creating an opaque graphics object -- you have to use the hidden properties to fi...

5 years ago | 5

| accepted

Answered
Round Datetime to certain minutes
interp1 will work... dt=datetime(2020,11,18,00,1+[0:30].',0); % sample datetime array dt20=datetime(2020,11,17,0,[20:30...

5 years ago | 0

| accepted

Answered
How do i add a seed
See <Controlling-random-number-generation> for discussion and links to rng function if it is needed to modify default seed to be...

5 years ago | 0

Answered
How to read gaps from an Excel in MATLAB
It's readmatrix probably that's the problem as it is designed for matrix input and you have what looks like two (or several) mat...

5 years ago | 0

| accepted

Answered
Reduce loops to Vectors in Viola Jones Algorithm
I don't have the time right now, but the two inner loops should be replaceable by filter2 or conv2. NB: filter2 has an internal...

5 years ago | 0

Answered
How would I be able to output ID's that satisfied an if statement?
Use logical indexing, "the MATLAB way". LIMIT=50; % don't put magic numbers inside code; use variables so can change ...

5 years ago | 0

Answered
Two cell arrays indexing
C=cellfun(@(a,b)b(a),A,B,'UniformOutput',false); It's just logical indexing in a background loop under the guise of cell addres...

5 years ago | 0

| accepted

Answered
How to plot over histogram function
>> figure(2) [h] = histogram(norm,100); ... Error using norm Not enough input arguments. >> Your code even if fix the abo...

5 years ago | 0

| accepted

Answered
Changing the range of values in a Matrix
E=2*pi/3500*E-pi;

5 years ago | 0

Answered
Numeric miscalculation on the 14th decimal place
MATLAB used double precision floating point for calculations which is good to roughly 15 decimal digits. Hence, when you subtra...

5 years ago | 2

| accepted

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...

5 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...

5 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...

5 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...

5 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";...

5 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...

5 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....

5 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...

5 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...

5 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...

5 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...

5 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);

5 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...

5 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...

5 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!

5 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...

5 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...

5 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 ...

5 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...

5 years ago | 0

| accepted

Load more