Answered
Splitting a table using varagin
"The matlab documentation states that the first term in the bracket after splittaply should be a function such as @max" The SPL...

4 years ago | 0

| accepted

Answered
Use a ready p-file to operate on matrices
Your approach is complex, obfuscated, and inefficient. Using numbered variables is a sign that you are doing something wrong. R...

4 years ago | 1

| accepted

Answered
Convert time in decimal days into hh:mm:ss format
N = 0.504513888888889; T = days(N); T.Format = 'hh:mm:ss' or D = datetime(N,'ConvertFrom','excel'); T = timeofday(D)

4 years ago | 0

Answered
Extracting numerator and denominator values from a decimal value
[N,D] = rat(6.52) Multiply both by four if you want to.

4 years ago | 1

| accepted

Answered
Efficiently identifying a set of 1s: follow up question after months later
A simpler, more efficient, much more robust solution: a = [1,1,1,-1,0,0,0,0,1,1,-1,0,0,1,1,1,1,-1,0,0]; d = diff([false,a==1,f...

4 years ago | 0

| accepted

Answered
Any efficient way to identify a set of 1s in a big array?
A simple, efficient, robust solution: a = [1,1,1,-1,0,0,0,0,1,1,-1,0,0,1,1,1,1,-1,0,0]; d = diff([false,a==1,false]); s = fin...

4 years ago | 0

| accepted

Answered
Problem with datetime in German
There does seem to be a problem with DATETIME handling the period characters (below). Workaround: replace/remove the period cha...

4 years ago | 0

| accepted

Answered
Storing many digits using readtable
Any advice that "you are going to need to read the file as text" is incorrect. It is much better to import and store numeric da...

4 years ago | 0

| accepted

Answered
How to see if characters are present in a string array.
Assuming that all string elements contain exactly the same number of characters, then you can do this easily with basci logical ...

4 years ago | 0

| accepted

Answered
Subtracting Matrices in Special way
If the A values are copied first then only two ISMEMBER are required (simpler, more efficient), nor any resizing or changing of ...

4 years ago | 1

Answered
How do I get values of a certain parameter in a multi-dimensional matrix?
a(~Ind) = NaN

4 years ago | 0

| accepted

Answered
Display file names from current directory if more than n characters
n = 5; P = 'absolute or relative path to where the files are saved'; S = dir(fullfile(P,'*.*')); C = {S(~[S.isdir]).name}; % ...

4 years ago | 0

| accepted

Answered
Comparision double values 135 with 135.0000
" A comparision with a simple if-statement and the == operator does not succeed." Yes, it does succeed: their values are differ...

4 years ago | 0

| accepted

Answered
Is it possible to fprintf/sprintf each row of elements in a vector using loop?
I would not use a loop: N = ["Earth"; "Venus"; "Mars"]; V = ["1.0000"; "0.8975"; "0.3915"]; fprintf('%s %s Gravity\n', [V(:),...

4 years ago | 2

| accepted

Answered
How can I import a file.txt and extract data?
opt = {'CollectOutput',true}; [fid,msg] = fopen('prova2.txt'); assert(fid>=3,'%s',msg) hdr = fgetl(fid); out = textscan(fid,...

4 years ago | 1

| accepted

Answered
Find values that are greater than a specific number in a table
nnz(Lake>=20)

4 years ago | 0

| accepted

Answered
Directly perform a multiplication on certain variables in a table
T = cell2table({'a',1,2;'b',3,4;'a',5,6},'VariableNames',{'x','y','z'}) idx = strcmp(T.x,'b'); T{idx,{'y','z'}} = T{idx,{'y','...

4 years ago | 0

| accepted

Answered
Recording vectors in for loop, when the loop is running in a range starting with negative numbers
Data are not indices, do not mix them up. V = -nmax:1:nmax; % data!!!! for k = 1:numel(V) % indices!!!!! n = V(k); % data...

4 years ago | 0

| accepted

Answered
How can I ask Matlab to adjust a parameter in an equation until the answer becomes equal with a predetermined input value?
Use FZERO: https://www.mathworks.com/help/matlab/ref/fzero.html Define a simple anonymous function with one input which calcula...

4 years ago | 1

| accepted

Answered
Conditions else if - efficiency advice
inp = '003'; % S group subS = {'001','002','003'}; aS = {'R','O','O'}; % T group subT = {'01','02','03'}; aT = {'O','O','R...

4 years ago | 0

| accepted

Answered
Calculate this matrix in a more general and shorter way
x = rand(100,1); w = pi; m = (1:5).*w.*x; m = [ones(100,1),reshape([cos(m);sin(m)],100,[])]; for comparison: P = [ones(size...

4 years ago | 1

Answered
Undefined variable in workspace problem
"where measurementValue is an n x 1 double array already loaded in my workspace." I guess you mean that it is loaded into the b...

4 years ago | 0

Answered
How to call a value from the command window to the editor window
Ugh, P-Files. You could try using EVALC: https://www.mathworks.com/help/matlab/ref/evalc.html and then parsing the string that...

4 years ago | 1

Answered
Getting error that output argument is not assigned during function when it is?
When direc is empty then ccmp is not defined (exactly as the error message states). This error is easy to demonstrate (showing ...

4 years ago | 0

Answered
@ Symbol in function handles as an input variable to another function
"if i were to remove the @ sign it would tell me that i am missing input arguments..." Because in that case you are just callin...

4 years ago | 0

| accepted

Answered
strcmp function using wildcards
T = cell2table({'A','XXX';'B','G22';'C','G13';'D','G1234';'E','YYY';'F','G01'}) idx = ~cellfun(@isempty,regexp(T.Var2,'^G\d\d$'...

4 years ago | 1

| accepted

Answered
How to read hh:mm:ss.sss time format from a file that has time and other data
Because you did not upload a sample file I had to create my own (attached). T = readtable('test.txt') T.Var1

4 years ago | 0

Answered
Find the different elements in a cell array
Where out is your cell array: fnh = @(v) any(v(:)==1)&&any(v(:)==2); idx = cellfun(fnh,out)

4 years ago | 0

| accepted

Answered
includeSubFolders name value pair argument
imageDatastore(imdir, "IncludeSubfolders",true, "LabelSource","foldernames"); % ^^^^ yo...

4 years ago | 0

| accepted

Load more