Answered
string to double conversion
Current = '+5.004100E-07,+5.006900E-07,+5.003900E-07,+5.003100E-07,+5.003300E-07,+5.003700E-07,+5.004800E-07,+5.003200E-07,+5.00...

15 dagen ago | 0

| accepted

Answered
Undefined function 'cost' for input arguments of type 'char'.
cost I(:,i)=alpha+(beta.*P)+(gamma.*P.*P); % ^ remove this space character total Cost_iteration(i,1)=sum(costI(:,i)); % ...

15 dagen ago | 0

Answered
How can I create a list of files of the defined typ that are included in the folder?
folder = '...'; typ = 'm'; T = sprintf('*.%s',typ); G = genpath(folder); F = regexp(G,'[^:]+','match'); C = cell(size(F)); ...

16 dagen ago | 1

| accepted

Answered
Why I cannot create a function handle composed of a sum of function handles in a cell with a vector input?
x = 0:0.01:pi; %Input vector n = 5; %order m = 0:n; %Positive modes %My exam...

16 dagen ago | 0

| accepted

Answered
??!>>>Error using fprintf Invalid file identifier. Use fopen to generate a valid file identifier.
Do NOT use the installation folder of ANY application for your current folder: Trying to save/alter files in the installation...

17 dagen ago | 0

| accepted

Answered
How do I sort data in a table in ascending order given specific Series type in Column
Either data = sortrows(data,{'Series','Year'}) or data = sortrows(data,{'Year','Series'}) depending on what you expect the o...

17 dagen ago | 0

Answered
Row and Cloumn find in cell array
What you want is actually the cell index and the index of the cell content, not the "row and column" index as you wrote. f = {[...

18 dagen ago | 0

Answered
extracting numbers with decimal places from the body of text file and assigning to a variable
%str = fileread(..) % <- simpler way to import the file data. str = sprintf('%s\n','Header with text and comments','other text ...

18 dagen ago | 1

| accepted

Answered
Loop does not save intermediary steps
"Loop does not save intermediary steps" because nothing in your code makes any attempt to save them. Because each diagonal has ...

19 dagen ago | 0

| accepted

Answered
interpn vs griddata, not producing the same results when interpolation is only in 2 dimensions
Your code seems to have some bugs: the first and second dimensions should NOT be included in the indices for griddata (i.e. the...

20 dagen ago | 0

Answered
Creating dynamic variables using loops | Automatic Variables using loops
"How do I bypass this without creating variables using loops." Here is a simple solution using basic MATLAB operations, no bad ...

20 dagen ago | 2

Answered
How to extract valid and invalid values from 1 array into 2 new arrays?
The loop does nothing, get rid of it. Using find will not solve your problem. The actual problem is that your logic for either ...

21 dagen ago | 0

Answered
Creating a for loop that calls to a separate function script and collects outputs in vector
One simple approach: cnt = 0; Results = nan(n*n,7); % preallocate 10000x7 for ii = 1:n for jj = 1:n cnt = cnt+1...

21 dagen ago | 0

| accepted

Answered
How to get next higher value from vector in Matlab ?
B = [0,0,1,2,4,-7,20,-9,-1,0]; X = cumsum([true;diff(B(:))<0]); Y = accumarray(X,B(:),[],@max); Z = Y(X); Z(3) Z(6)

21 dagen ago | 0

Answered
Define new operations for a matrix
x = [0,1,2,0,1,0,3,1,0]; y = x.'; V = 0:3; % define value range of multiplication table M = [0,1,2,3;1,0,3,2;2,3,0,1;3,2,1,0]...

21 dagen ago | 0

| accepted

Answered
Is there a readfile() function in Matlab?
Perhaps they meant this third-party function: https://www.mathworks.com/matlabcentral/fileexchange/68780-readfile/ To get a co...

22 dagen ago | 0

| accepted

Answered
Continuous Loop operation with conditional statements in table and then calculation
No need to use a loop: T = [1317;1327;1342;1390;1391;1392;1393;1446;1453;1464;1491;1607;1608;1609]; D = diff([false;diff(T)==1...

22 dagen ago | 0

| accepted

Answered
Recoding unique numbers to another number
The simple and efficient MATLAB solution: X = [5,5,6,6,6,11,11]; [~,~,Z] = unique(X,'stable')

23 dagen ago | 0

| accepted

Answered
Two numbers that should be equal are not, fractional part showing different values after 17th fractional digit
"Why does this happen? What could have caused such imprecision during calculation?" Operations on binary floating point numbers...

23 dagen ago | 3

| accepted

Answered
How to change big fractions in small numbers in command windows
syms s S u=(4*s)-(3*sym(pi)); v=(s^2)+(sym(pi)^2); f(S)=u/v; ilaplace(f(S))

23 dagen ago | 1

Answered
How to create a categorical variable with a specified number of characters?
labels = [repmat('N',1883,1);repmat('A',332,1)]; or less robustly: labels( 1:1883,1) = 'N'; labels(1884:2215,1) = 'A'; % ...

24 dagen ago | 0

| accepted

Answered
Profiling of inefficient recursive Fibonacci series function
Perhaps something like this: [val,vec] = fibo(6) function [f,t] = fibo(n) if n <= 2 f = 1; t = f; ...

27 dagen ago | 1

| accepted

Answered
Adds one element in vector from another, by position in array
x = 1:100; % superfluous square brackets removed. y = x(3:end-1)+x(4:end) % the MATLAB way.

27 dagen ago | 0

| accepted

Answered
How to turn a string into a line of differential equation for ode45?
Ugh, do NOT use eval for this! If the string is actually a symbolic expression then use odeFunction as Walter Roberson stated. ...

27 dagen ago | 1

Answered
Comparing cell arrays and creation of subfolders
A much more robust approach using absolute filenames (rather than buggy and slow CD) and function syntax rather than outdated co...

27 dagen ago | 0

Answered
For loops for functions that create structure arrays.
Your indexing throws an error because beta_list has only one column but you are trying to access columns 2 to 61, which don't ex...

ongeveer een maand ago | 0

Answered
How to create an N-ary array
N = 4; K = 3; C = cell(1,K); [C{:}] = ndgrid(1:N); C = cellfun(@(m)m(:),C,'uni',0); M = [C{:}] ... lots more rows here not...

ongeveer een maand ago | 0

Answered
Hex 01A9 to 16-binary?
No loops, no padding, works correctly for any number of hex digits (not just 16 bits): H = '01A9'; B = reshape(dec2bin(sscanf(...

ongeveer een maand ago | 1

Answered
How to modify a list of filenames in a specific way?
S = ["vul1_4_9.txt" "bat1_1_1.txt" "chy1_1_16.txt" "chy1_1_17.txt" "g6_1_18.txt" "stcv1_1_1.txt" "...

ongeveer een maand ago | 0

| accepted

Answered
Import matrices with same name and dimensions from different Data
"What should i do ?" Load into an output variable, not directly into the workspace. Loading into an output variable will avoid...

ongeveer een maand ago | 0

Load more