Answered
Solve systems of linear equations Ax = B for x
"But ,what is the operation between the rows?" Both mldivide and mrdivide can use many different algorithms for solving systems...

7 years ago | 0

| accepted

Answered
Calling evalin with three arguments
The third (as far as I can tell) totally undocumented input argument provides a default value if a specific variable is not foun...

7 years ago | 0

| accepted

Answered
How do I check if a folder exists which has a variable name?
[~,name] = fileparts(fname); exist(fullfile('Figures',name), 'dir')~=7 Note that exist does NOT return a boolean value, it ret...

7 years ago | 1

| accepted

Answered
Function definition is misplaced or improperly nested error
Once the code is aligned properly then the problem is clear: for ... for ... for ... for ... ...

7 years ago | 0

| accepted

Answered
Apply hold on to multiple figures in a loop
"how to apply the "hold on" to each figure" The properties affected by hold are all axes properties, which have nothing to do w...

7 years ago | 0

| accepted

Answered
Trying to request user input and then perform if elseif else end function...
"...which is the best way to create an empty output for storing text info..." Use a cell array or a string array, e.g.: out = ...

7 years ago | 0

| accepted

Answered
Change line colour depending on y axis value
Method one: FEX Some of these might do what you want: https://www.mathworks.com/matlabcentral/fileexchange/39972-colormapline-...

7 years ago | 0

Answered
Loop to generate random numbers and compile results for each iterations
You could easily use a cell array: N = 100; Z = cell(1,N); for k = 1:N ... your code Z{k} = whatever you want to st...

7 years ago | 0

| accepted

Answered
How to sort matrix based on another matrix?
>> A = [3,2,1;8,3,1;6,4,2] A = 3 2 1 8 3 1 6 4 2 >> B = [5,9,2;9,2,1;8,7,4] B = 5 9 2 9 2 1 8 7 ...

7 years ago | 0

| accepted

Answered
Get variable name into filename using strcat
Nowhere do you describe/show what the output filename should look like, but this should get you started: >> sno = 5100; >> inp...

7 years ago | 0

| accepted

Answered
Replacing strings with varying length and numbers
>> str = 'Phase1_525kV_4km_100m_0.5ohm'; >> out = regexprep(str,'\d+\.?\d*[a-zA-Z]+','X') out = Phase1_X_X_X_X

7 years ago | 0

| accepted

Answered
How do I speed up plotting of interactable scatter points?
Actually one single plot or line call can generate multiple line objects even if each one line only contains one point, the tric...

7 years ago | 0

| accepted

Answered
permutations of a matrix
Based on this efficient concept for generating a matrix of binary combinations: https://www.mathworks.com/matlabcentral/fileexc...

7 years ago | 1

| accepted

Answered
How to Scale Array Indices to larger array indices?
Here is one simple approach based on diff and find. Because a scaling factor of 68608 is rather inconvenient I used a scaling f...

7 years ago | 0

| accepted

Answered
str2num strange behaviour
"str2num strange behaviour" It is not strange behavior at all: str2num (unfortunately) relies on eval, as the str2num help clea...

7 years ago | 1

| accepted

Answered
How to extract data from a multi layered structure
"How can i calculate the minimum of a given field (min_temp for example) ?" You do not define what "the minimum" means for mul...

7 years ago | 0

Answered
Shift data in row when NaNs occurs
>> M = [0.30,NaN,0.24,0.26,0.67,0.37;0.49,0.35,0.55,NaN,0.43,0.54] M = 0.30000 NaN 0.24000 0.26000 0.67000 0....

7 years ago | 0

| accepted

Answered
Reading Data from txt file with a unique FormatSpec
Method one: fileread and regexp and str2double: >> S = fileread('Test.txt'); >> M = reshape(str2double(regexp(S,'[+-]?\d*\.?\d...

7 years ago | 0

Answered
Directory Issue - not finding subfolder
"Any advice on how to approach this issue is appreciated." Do not use cd. Do not add data folders to the Search Path. Use abs...

7 years ago | 1

| accepted

Answered
filter string in the string
>> str = 'this matlab is a good software, it is a version 9.4 which is equal to 2018a'; >> out = regexp(str,'\d+\.\d+','match'...

7 years ago | 1

Answered
Store results of for loop in matrix
Use a cell array: N = numel(ab); out = cell(1,N); % preallocate cell array. for k = 1:N ... your code out{k} = Ncel...

7 years ago | 0

| accepted

Answered
How to pass Options as an argument in quadprog
x = quadprog(H,f,[],[],[],[],[],[],[],options)

7 years ago | 0

| accepted

Answered
convert string of numbers to double
More efficient than converting to symbolic and probably also str2num: >> S = '676, 933, 1645, 2069:.025:2069.5, 2327:.025:2327....

7 years ago | 0

Answered
How to create new file in another folder?
" But I have create the new file in another folder . How can I do this?" All MATLAB functions that read/write to data files acc...

7 years ago | 3

| accepted

Answered
how to load a variable in a loop
D = dir('CC*/Rest/ROI_epi.mat'); for k = 1:numel(D) F = fullfile(D(k).folder,D(k).name); S = load(F); ROI = S.RO...

7 years ago | 0

Answered
Why use x=load('myFile.mat')?
From the discussion following this answer: "why should people never ever load mat files into the workspace?" Because load-ing ...

7 years ago | 1

Answered
Increasing number of points in a plot without ruining the shape
Try using method spline or pchip and see if they do what you want: interp1(...,'pchip') https://www.mathworks.com/help/matlab/...

7 years ago | 0

Answered
Testing if an input is numeric or character
if isnan(Sbase_gerador) ... end

7 years ago | 0

| accepted

Answered
how to call different functions of a matlab file to another matlab file
Local functions are only visible to other functions within the same M-file: https://www.mathworks.com/help/matlab/matlab_prog/l...

7 years ago | 0

Answered
saving for loop results not working
"Can anyone please explain to me what im doing wrong and how to fix it." Your first code does not store/allocate/sum the output...

7 years ago | 0

| accepted

Load more