Answered
How do I create a "function function"? How do you make a function that accepts another arbitrary function as an input argument?
_'... a special type of function in MATLAB called a "function function".'_ There is nothing special about a function that acc...

8 years ago | 0

| accepted

Answered
comparing values and using the results
_"how will i write a code that will automatically compare and give a result saying a particular code is strongest"_ By changi...

8 years ago | 0

Answered
How to save a text file as a .mat file?
M = csvread('oldfile.txt'); save('newfile.mat','M')

8 years ago | 1

Answered
Not enough input arguments
Read the documentation. The <https://www.mathworks.com/help/signal/ref/ss2sos.html |ss2sos|> help clearly lists all of the synta...

8 years ago | 0

| accepted

Answered
allocate values avoiding loop
Some indexing using the first column does what you want, more efficiently than a loop or |unique|: >> M = [1,1,-1.1471;1,2,...

8 years ago | 1

| accepted

Answered
While loop is not recognizing a defined variable
_"While loop is not recognizing a defined variable"_ Because that variable is _not_ defined. You clear |To6| several time...

8 years ago | 0

Answered
How to horizontally concatenate the cells of a cell array with different contents into a string.
An old-fashioned way (strings are probably easier): >> C = {550,2,'GAM';600,2,'GAM';650,2,'GAM';700,2,'GAM';750,2,'GAM';800...

8 years ago | 0

Answered
A=[1 2;n 5;3 5;6 8] .......... very long matrix i want do a condition for reed my rows and when he find a character he delet this rows B=(315151,3) very long matrix expmple reed if you have a character do delet this rows
This reads your sample data file (attached) into a numeric matrix, ignoring the headers and empty lines: fmt = repmat('%f',...

8 years ago | 0

| accepted

Answered
How can I use resolve this error on the getslopeintercept function It worked well in the past (2014) for me but its yielding errors in the current Matlab version.
_"...It worked well in the past (2014) for me but its yielding errors in the current Matlab version."_ I would not assume tha...

8 years ago | 0

Answered
fprintf break line different arrays
It is easier when you put your vectors into one cell array: C = {[1,2,3,4,5,6,7,8,9,10,11],[12,13,14,15,16]}; F = [repma...

8 years ago | 0

| accepted

Answered
Matrix manipulation problem under MATLAB
Storing scalar numerics in cell arrays will make your processing pointlessly complex, so I will presume that you actually sensib...

8 years ago | 0

| accepted

Answered
Why array only saves last run of results from nested FOR Loop?
_"I created a for loops..."_ Yes, you did. _"...and store values for each loops in array."_ No, you did not. _"Could...

8 years ago | 1

| accepted

Answered
how to make a sorting line by line?
Here are two methods that match <https://www.mathworks.com/matlabcentral/answers/428610-how-to-make-a-sorting-line-by-line#comme...

8 years ago | 0

| accepted

Answered
Why is nothing coming up on my plot?
MATLAB is a high-level language, so forget about loops and use logical indexing: x = -5:0.01:5; y = -10+zeros(1,numel(x)...

8 years ago | 1

Answered
VERY odd error with simple multiplication ... OK... not so odd.
"Does anyone have any idea why this is happening?" Yes, the behaviors of floating point numbers are quite well documented, and ...

8 years ago | 3

| accepted

Answered
Creating a variable from part of a string
I recommend that you use a structure instead of magically accessing variable names: >> x = 'dr_1e-2_A1_OFF_A2_OFF.txt'; ...

8 years ago | 1

| accepted

Answered
How to count the top five pairs (for each digit) which have the highest number of occurrences in a cell array?
Simpler: >> C = {[1;3;5;4;6]; [1;2;3;4;5;6;7]; [1;4;3;6]}; >> H = cellfun(@(v)hankel(v(1:end-1),v(end-1:end)),C,'uni',0)...

8 years ago | 1

Answered
How can I extract L, A and B value from LAB value ?
L = lab_he(:,:,1); a = lab_he(:,:,2); b = lab_he(:,:,3); To save: csvwrite('L.csv',L) etc.

8 years ago | 0

| accepted

Answered
cell to matrix with numerical and logical values
Where each cell contains a scalar numeric or logical: cell2mat(cellfun(@double,C))

8 years ago | 0

Answered
How to count the total number of occurrences of each digit in cell arrays?
>> C = {[1; 4; 7]; [2; 5; 8; 9]; [3; 4]}; >> V = cellfun(@(v)v(2),C); >> U = unique(V); >> N = histc(V,U); >> [U,N...

8 years ago | 0

| accepted

Answered
How to interpolate based on given column
No need to use interpolation, just some simple, efficient arithmetic: >> V = [0.2;0.8;1.0;1.3;0.8;2.3;4.9;10.0;0.2;5;2.3;8....

8 years ago | 1

| accepted

Answered
Speed up for loop, accumarray
This gives exactly the same output as your code: H = accumarray(reshape(idx,[],3),1); First I ran your code on some rand...

8 years ago | 1

| accepted

Answered
How to create large data in MATLAB. For large array showing out of memory.
<https://www.mathworks.com/help/matlab/large-files-and-big-data.html> <https://www.mathworks.com/help/matlab/import_export/ta...

8 years ago | 0

Answered
is it possible to input two variable values while loading a function from commend menu?
You should use |sprintf| and |fullfile|: D = 'directory where the folders should be located'; for ii = 1:n B = sp...

8 years ago | 0

Answered
Function returns wrong data if fed a list of numbers instead of a single number
The simple MATLAB solution is to use logical indexing: x = 0:0.1:200; y = x; y(x>75) = 25; plot(x,y) If you wan...

8 years ago | 2

Answered
Compare column vector to column in a Matrix and extract data
Do not use loops for this. MATLAB is a high-level langauge, it is not C++. It is not completely clear what you expect to get,...

8 years ago | 2

Answered
How do I use the strsplit function to split a sentence into a string of letters?
It is not very clear what exactly you want to achieve (you did not give any input and output examples), but here are some possib...

8 years ago | 0

Answered
How TABLE retreive the variable names?
<https://www.mathworks.com/help/matlab/ref/inputname.html>

8 years ago | 1

| accepted

Answered
too many input arguments
The first input to |prctile| must be numeric (double or single). So your cell array will need to be converted to numeric. You wr...

8 years ago | 0

| accepted

Answered
ODE, how to retrive variables computed in the previous step
The simplest solution is: use <https://www.mathworks.com/help/matlab/matlab_prog/nested-functions.html nested functions>. Wri...

8 years ago | 1

| accepted

Load more