Answered
Lines are a no show using loglog and a for loop
The plot is not showing any lines because you did not plot any lines. You just plotted some individual, totally separate and dis...

10 years ago | 0

| accepted

Answered
parse error at .... :usage might be invalid matlab syntax
According to the MATLAB documentation <https://www.mathworks.com/help/matlab/matlab_prog/local-functions-in-scripts.html Add Fun...

10 years ago | 0

Answered
Why do the DIR and LS functions in MATLAB not sort numerical filenames in numerical order?
Simple solution: download my FEX submission natsortfiles, which sorts filenames into alphanumeric order: S = dir('*.txt'); S.n...

10 years ago | 4

Answered
Why help on 'str' yield help on 'std'?
Don't use |help| to check if a name is already used: the best function for this is <https://www.mathworks.com/help/matlab/ref/wh...

10 years ago | 1

| accepted

Answered
I want to change the first number of each cell without changing the other numbers. C is 3*1 cell. For example change 32 to 65.
>> C = {'1 555.00 554.10 552. 550.2 549. 545.59'; '32 553.38 552.40 550.3 548.91 ...

10 years ago | 1

| accepted

Answered
Concatenating doubles in cell arrays
Where |A| and |B| are the input cell arrays: cellfun(@(a,b)[a;b],A,B,'UniformOutput',false) Or even cellfun(@vertcat,...

10 years ago | 1

| accepted

Answered
Using for loops to find values of n
Welcome to the world of floating point numbers. Many beginners get confused by floating point numbers, because they imagine that...

10 years ago | 0

Answered
elseif and if commands
You need to call |input| with the |'s'| option to get it to return a string (without this option is slow and a security risk any...

10 years ago | 0

| accepted

Answered
reconstruct matrix from vector coordinates
You could use <https://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|>: sz = [max(x),max(y)]; ix = sub2ind(sz,x,...

10 years ago | 1

Answered
How to remove second digit of first a column
>> rem(A,10) ans = 1 2 4 3 3 4

10 years ago | 1

Answered
Strange behaviour of MATLAB find command
This is not a strange behavior at all, it has nothing to do with find, and it has nothing to do with the changes on your compute...

10 years ago | 2

| accepted

Answered
How to count no of iterations of first digit.
Assuming that there are always two digits: >> a = [11 3; 12 4; 13 3; 21 2; 22 5...

10 years ago | 1

| accepted

Answered
Problem to display a matrix?
This is a good example of how badly formatted code is makes writing bugs easy, and finding bugs hard. The code is badly aligned,...

10 years ago | 0

Answered
time format as hr:min:sec
>> hr=[10,10,10,10]; >> min=[00,00,01,01]; >> sec=[00,30,00,30]; >> fprintf('%02d:%02d:%02d\n',[hr;min;sec]) 10:00...

10 years ago | 2

Answered
How can I create a structure with a loop?
*Non-scalar Structure:* I do not really follow your example, but perhaps the best solution wold be to use a <https://www.mathwor...

10 years ago | 2

| accepted

Answered
Question related to vectorized matrix operation.
>> A = randi(9,4,3) A = 4 2 9 9 4 4 5 4 8 4 2 8 >> B = r...

10 years ago | 0

| accepted

Answered
Returning NaN after mean calculation?
_"I created a function that takes 5 elements of an array, calculates the mean and puts the value into another array. It does tha...

10 years ago | 0

| accepted

Answered
Creating a hex array with 4 digit blocks from an array of integers
V = [1,2,4,69876]; L = log(16); for k = 1:numel(V) N = 4*(1+fix(log(V(k))/L/4)); S = sprintf('%0*X',N,V(k)...

10 years ago | 0

| accepted

Answered
Error while mutliplying functions.
You cannot multiply function handles. You can either: 1) evaluate the function handles for some value/s, and multiply their o...

10 years ago | 0

| accepted

Answered
How to sort vector alternatively
>> a = [1,3; 3,4; 3,6; 4,8] a = 1 3 3 4 3 6 4 8 >> tmp = sortrows(a,2); ...

10 years ago | 0

| accepted

Answered
if loop within for loop for statistical analysis of data
This is a classic example of how badly formatted code makes buggy code. When the code is formatted using MATLAB's default format...

10 years ago | 0

| accepted

Answered
Hello, I am developing one GUI in which, I want to plot 4 graphs on the same axes. Can anyone suggest me to get solution on this problem? Thanks...!
plot(handles.plotAxes, S,I, X11,Y11, X22,Y22); or plot(handles.plotAxes, [S,X11,X22],[I,Y11,Y22])

10 years ago | 0

| accepted

Answered
How to get the vector rankings as per values without common rankings
One easy way is to add a very small value to each element of the vector to make them all unique: >> x = [1,3,4,2,3]; >> ...

10 years ago | 0

| accepted

Answered
Save new name in file .mat and loop new name
Do not do this. Some other beginners will tell you to use |eval| or |evalin|, but this is bad advice. This makes slow and buggy ...

10 years ago | 0

Answered
Calling multiple matlab scripts in to single script?
_"Is it possible to do"_ We don't know this unless you give us more information. Do you call |figure| in those scripts? Do yo...

10 years ago | 0

Answered
Call elements for a cell array
C = {0:3, 4:5, 6:9}; out = NaN(size(C)); for k = 1:numel(C) out(k) = mean(C{k}); end or if the outputs are non-s...

10 years ago | 0

| accepted

Answered
How do I plot y=(x/6)^3 in matlab?
>> x = 0:0.1:3; >> y = (x/6).^3; >> plot(x,y) <</matlabcentral/answers/uploaded_files/67959/Capture.PNG>>

10 years ago | 0

| accepted

Answered
Replacing only certain instances of text within matlab character array
*Method One: split the string* >> str = '___6002__6002___6002___6002__'; >> idx = regexp(str,'6002','once','end'); >>...

10 years ago | 1

| accepted

Answered
How to use str2double without rounding
<https://www.mathworks.com/help/matlab/ref/str2double.html |str2double|> does not do any rounding: does its documentation mentio...

10 years ago | 1

Answered
Adding new values in between existing values in an array
@Sancheet Hoque: what you are trying to do is called _interpolation_. MATLAB has a nice <https://www.mathworks.com/help/matlab/i...

10 years ago | 2

| accepted

Load more