Answered
How to feed additional variables into fsolve function
https://www.mathworks.com/help/optim/ug/passing-extra-parameters.html dv = [3610.30,2040.80,1203.70,483.04,106.03,15.54,3.39,1....

5 years ago | 1

| accepted

Answered
How do you enforce Element-wise operations in function handles?
There is no trivial answer to this. Fundamentally your request involves swapping operators, just as if you requested to replace ...

5 years ago | 0

Answered
remove the first 2 char of a string
What you show is a character vector, not a string. Which makes this easy using indexing: c = ',''B132-32'',''B134-22'',''S132-1...

5 years ago | 0

| accepted

Answered
How do I check if all numbers in a vector are the same?
all(diff(A)==0) min(A)==max(A) % does not work for NaN range(A)==0 % RANGE requires the statistics toolbox numel(unique(A))==...

5 years ago | 1

| accepted

Answered
convert Vector into matrix ?
A = [1,2,3,4,5]; B = hankel(A(1:3),A(3:5))

5 years ago | 0

Answered
Sort a table with different orders for different columns
Where T is your table: sortrows(T,[1,2,-3])

5 years ago | 1

| accepted

Answered
How to construct indicator function in array function?
I don't see why you need arrayfun: f = [2;3;4]; g = [2.5;4;8]; fun = @(x) x>=f & x<=g; fun(2.1) fun(4) % your example is in...

5 years ago | 0

| accepted

Answered
Combining two character arrays so that the elements of one of them is added in between the elements of the other one
x = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; a = 'AAAAAAAAAAAAAAAAAAAAAAAAAA'; out = reshape([a;x],1,[])

5 years ago | 1

| accepted

Answered
How do I call functions with names generated by str2func, varargin, and input argument blocks?
function callTagFunction(tag,varargin) myFunction=str2func(tag); if nargin ==1 myFunction(); else myFunction(vararg...

5 years ago | 0

| accepted

Answered
fprintf parse error, invalid matlab syntax
fprintf(N_file,'G01 X%1.6f Y%1.6f C%1.0f B360;\n', -i*s, sqrt(r^2-(-i*s)^2)-r),newt); % ...

5 years ago | 0

| accepted

Answered
Refer to structure names
F = fieldnames(A); B.(F{1}) = table1 B.(F{2}) = table2 https://www.mathworks.com/help/matlab/matlab_prog/generate-field-names...

5 years ago | 1

| accepted

Answered
Extracting number from a string
str = 'TotalPower:9,7406E+00Watts'; num = sscanf(strrep(str,',','.'),'%*[^:]:%f')

5 years ago | 1

| accepted

Answered
Error in for loop calculation
You are confusing data with indices. Do not use data as indices. temperature = 212 ; % temperature in deg F oilapi = 41 ; % oi...

5 years ago | 0

| accepted

Answered
how to extract all columns in between two variable names (column header) of a table?
Age = [38;43;38;40;49]; Smoker = logical([1;0;1;0;1]); Height = [71;69;64;67;64]; Weight = [176;163;131;133;119]; T = table(...

5 years ago | 0

| accepted

Answered
storing matrix elements in a single variable as string
A = [3,25,100,5,20,100]; S = compose("%d#%d@%d",A)

5 years ago | 1

Answered
Cell array to text form
I suspect that you are confusing how data are stored with how they are defined and displayed, but anyway: C = {'L1125';'Y8898';...

5 years ago | 0

Answered
define variable from cell content
Simpler and much more efficient than what you are attempting is to use a basic structure: C1 = {'abc','def','ghi'}; C2 = {'1',...

5 years ago | 0

Answered
Find string inside a cell array
Skip the loop and use ismember: S = dir('D:\ABIDEdataset\Outputs\dparsf\nofilt_noglobal\rois_aal\All_Groups'); C = extractfie...

5 years ago | 0

| accepted

Answered
MATLAB input function error; Output arguments.
You have created/added a function with name input, which shadows the inbuilt input function. Use which to find the location of ...

5 years ago | 2

| accepted

Answered
Use an input for a function
Use the 's' option to return the input unevaluated (i.e. as a character vector): https://www.mathworks.com/help/matlab/ref/inpu...

5 years ago | 0

| accepted

Answered
is there a cmd which can justify a script at once?
In the MATLAB editor: select the text you want to align (e.g. ctrl+a) press ctrl+i

5 years ago | 0

| accepted

Answered
Import several tables from one txt file in Matlab
str = fileread('temp.txt'); tkn = regexp(str,'^#TableID[^\n]*\s*([^\n]+)([^#]*)','lineanchors','tokens'); tkn = vertcat(tkn{:}...

5 years ago | 1

| accepted

Answered
Removing empty cells from cell array
Most likely converting the nested cell array to numeric arrays is going to make processing your data easier: S = load('G.mat');...

5 years ago | 0

| accepted

Answered
if statement with changing values
if numel(intersect(ID1,ID2))

5 years ago | 0

| accepted

Answered
Indexing for 4-D Arrays
You could use sub2ind: %% Build array dim = 40; volume = rand(dim,dim,dim,3); % simpler! %% Request data from 4d array ve...

5 years ago | 0

| accepted

Answered
My loop can't (sometimes...) evaluate its variable
"did I use something wrong ? " You are testing for exact equality of binary floating point numbers, which is unlikely to be rel...

5 years ago | 0

| accepted

Answered
regexp: extra cell layer in the output
"Could you please suggest me a way to force regexp to output a pure 1x4 cell array of tokens?" The simple answer to your questi...

5 years ago | 2

Answered
Plot datetime data from a cell array?
A cell array containing lots of scalar arrays indicates that your data is arranged sub-optimally. You would be much better off u...

5 years ago | 0

| accepted

Answered
Inserting new element after each element of an array
The MATLAB approach: arr = [2,4,6]; mat = repelem(de2bi(arr,'left-msb'),1,2)

5 years ago | 1

| accepted

Answered
How can i generalize "if statement"
Assuming that x is a four-element numeric vector or logical vector, something like this should work: if any(x) edges = edg...

5 years ago | 1

| accepted

Load more