Answered
Save and Load .mat files with different names that numerically go up automatically. Maybe in a for loop?
"...as long as there is a way to load multiple of these in one go, without them all overwriting each other as fvalagg" This is ...

7 years ago | 1

| accepted

Answered
How to use cellfun?
fun = @(x,y) fminbnd(@(c0)objfunc(y,deg(c0,x,'other input parameters')),cm,cM); [C,V] = cellfun(fun,XM,YM,'Uni',0)

7 years ago | 1

| accepted

Answered
Anonymous function to calculate a sum
>> fun = @(x,n) x + sum(x.^(2:2:2*n) ./ factorial(2:2:2*n)); >> fun(3,5) ans = 12.066 Compare against your expansion: >> x ...

7 years ago | 2

| accepted

Answered
how to open such files "File B -ASCII" saved from MATLAB?
The -ASCII option saves a double array as a text file with space delimiters. This means: Any text editor can open that text fil...

7 years ago | 1

| accepted

Answered
How to read rows of data in .csv file and turn them into arrays?
Notes to consider when importing a large file: Importing as character and then doing any kind of text manipulation before conve...

7 years ago | 0

| accepted

Answered
Display Value of a Slider in a text box without GUIDE
If you want the slider to update something (text, plot, anything) as it moves, then you will need to add a listener: https://ww...

7 years ago | 0

| accepted

Answered
Startup path issue creating variable errors
"How is it possible that I don't have a startup.m file on a clean install" Because it is a clean install: MATLAB does not creat...

7 years ago | 0

Answered
Function is not reading input from main script
You need to parameterize your function calls: https://www.mathworks.com/help/matlab/math/parameterizing-functions.html You nee...

7 years ago | 0

| accepted

Answered
'combnk' enumeration of combinations
>> [X,Y,Z] = ndgrid([-1,0,1]); >> M = [Z(:),Y(:),X(:)] M = -1 -1 -1 -1 -1 0 -1 -1 1 -1 0 -1 -1 0 ...

7 years ago | 0

| accepted

Answered
Problem with if-elseif when conditions contain several strings
"So I don't need a solution, but an explanation, why this occurs..." The first thing to do when trying to understand what your ...

7 years ago | 2

| accepted

Answered
How to read a specific number in a text file containing a mixture of strings and numbers?
The regular expression doesn't need to be so complex: >> chr = webread('http://tgftp.nws.noaa.gov/data/observations/metar/decod...

7 years ago | 0

Answered
How to load multiple specified variables in a specified mat file?
Your code does not make much sense: you added single quotes around the variable name (making it a literal string), you removed t...

7 years ago | 0

Answered
If B is a matrix,what is the difference between B(1:end) and B(:)
Given a matrix B: B(1:end) uses linear indexing. The size of the output is the same as the size of the index (which in your exa...

7 years ago | 2

| accepted

Answered
How to extract elements form a vector in order to create an unknown number of sub-vectors?
Here is one simple approach based on diff, cumsum, and accumarray: >> M = [2.24;2.28;2.31;0.99;1.44;1.44;1.44;1.44;2.12;2.25;2....

7 years ago | 1

| accepted

Answered
Extracting strings between different characters from a cell array without loop
>> C = {'LS=Students201509DS=Teachers201509CS=ConfigVS=English]' 'LS=Preschoolers201801DS=Students201910CS=AbsVS=Italian]' ...

7 years ago | 3

| accepted

Answered
how to determine the relative position of a number in a matrix
>> M = [1 0 0 0 % valid 1 0 0 1 % valid 1 0 0 -1 % valid 1 0 -1 0 % valid ...

7 years ago | 1

| accepted

Answered
Convert a vector to vector sequentially?
>> init = [1 2 3 4] >> final = [5 6 7 8] >> X = triu(ones(5,4)); >> M = init.*X + final.*~X M = 1 2 3 4 5 2...

7 years ago | 1

Answered
Loop function over multiple subfolders within one root folder?
The MATLAB documentation shows you can either obtain the names (i.e. using dir) or generate them (e.g. using sprintf): https://...

7 years ago | 0

Answered
turning date strings to overal minutes
Just use datetime, e.g.: >> C = {... '2019_12_31_17_43_31.39-Isd' '2019_12_31_17_19_36.39-Ig' '2019_12_31_16_55_41.38-Ig' '...

7 years ago | 0

| accepted

Answered
Efficient way of finding numbers from one matrix in another, not using for loops
Your code's slowness is partly due to the fact that you are expanding the output array ElementNodes on each loop iteration: this...

7 years ago | 1

| accepted

Answered
How determined lowest value in cell?
For some reason you want to get the number of rows but in your code you check the number of columns. Also your input to cellfun ...

7 years ago | 1

| accepted

Answered
how can i create this matrix
>> [I,J] = ndgrid(1:7,1:8); >> X = I>J; >> M = (2+2*~X).*J.*X - 2.*~X.*I - X M = -2 -2 -2 -2 -2 -2 -2 -2 ...

7 years ago | 0

Answered
set difference between two cell arrays
>> A = {2,[2,3]}; >> B = {2,3}; >> [XA,XB] = ndgrid(1:numel(A),1:numel(B)); >> X = arrayfun(@(xA,xB)isequal(A{xA},B{xB}),XA,X...

7 years ago | 0

| accepted

Answered
How to say concatenate from string 2 to end?
V = ["A","B","C","D"] W = join(V(2:end),"-")

7 years ago | 2

Answered
convert string to cell
If the inputs are scalar strings use + to append them together: equation{a} = Parameters(a) + "=" + a0 + "+" + a1 + "+" + a2; ...

7 years ago | 0

| accepted

Answered
regexp: what am I missing from the documentation?
A direct interpretation of your description "assume that all name instances in a character vector test have one of two possible ...

7 years ago | 3

| accepted

Answered
how to load multiple text files in nested folder?
Probably the sprintf method does what you need: https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files...

7 years ago | 0

| accepted

Answered
What is the meaning of ~ at fuction?
MATLAB has positional function input and output arguments. This means their purpose is determined entirely by their position whe...

7 years ago | 2

| accepted

Answered
Extracting values from a cell array into new arrays
Step 1: indexing: D = C(b(:,1)); Step 2: cellfun and an anonymous function: F = @(m,v)m(m(:,2)==v,:); Z = cellfun(F,D(:),num...

7 years ago | 0

Answered
How do I read only a specific lines from txt file and store as array?
This is easy and efficient with textscan: opt = {'HeaderLines',17,'CollectOutput',true}; fmt = repmat('%f',1,5); [fid,msg] = ...

7 years ago | 2

| accepted

Load more