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

15 días 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); % ...

15 días 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...

16 días ago | 1

| accepted

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

16 días ago | 0

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

16 días 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(...

16 días 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)

17 días 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';...

17 días 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',...

17 días 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...

18 días 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 ...

18 días 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...

19 días 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

20 días 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{:}...

20 días ago | 0

| 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');...

20 días ago | 0

| accepted

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

20 días 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...

21 días 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...

21 días 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...

21 días ago | 0

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

21 días 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)

21 días 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...

24 días ago | 1

| accepted

Answered
How to shift entries in a vector by the value of the number in that entry?
T = [0, 0, 4, 0, 7, 0, 0, 5, 0, 9] N = numel(T); X = 1+mod(T+(0:N-1),N); for k = 1:N T([k,X(k)]) = [0,T(k)]; end disp(...

27 días ago | 0

Answered
Plot multiple lines from multiple tables
By numbering your variables like that you have made the task a lot harder and more complex. The simpler and much more efficient...

27 días ago | 0

| accepted

Answered
Appending strings to array
"l = zeros(1,length(str)); % defining my empty list " That is not an "empty list": MATLAB does not have a "list" type. It is ...

28 días ago | 1

Answered
How can I remove characters in cvs file?
Using string manipulation: str = fileread('prueba1.csv'); str = strrep(strrep(str,'"',''),';',' '); mat = sscanf(str,'%f',[3,...

28 días ago | 0

| accepted

Answered
add Int8 and int16
add_int(int8(127),int16(129)) function out = add_int(in1,in2) out = int16(in1) + int16(in2); end

28 días ago | 1

Answered
Problems using "datetime" cont.
You should probably specify the input format to match the provided string: S = "12/24/2008 9:59:47 AM.786743640"; D = datetime...

29 días ago | 0

| accepted

Answered
Mean of matrix subarrays without using a loop.
A = [1 0 3 5 0 7; 0 2 6 0 8 0; 3 5 0 0 2 0] B = reshape(A.',3,[]); B(B==0) = NaN; C = reshape(mean(B,1,'omitnan'),[],size(A,1...

30 días ago | 1

| accepted

Answered
Extracting a matrix element which is within a cell containing cells.
Putting scalar numeric data into nested cell arrays is pointlessly complex and inefficient. Get rid of the cell arrays: S = loa...

30 días ago | 0

| accepted

Load more