Answered
how to get floating point number upto 4 decimal points
In what way does x11 = round(x*10000)/10000 %could be simply replaced by round(x, 4) not work? >>round(pi*10000)/1...

10 years ago | 1

Answered
How to find the first and last nonzero values in an array?
h = [0,0,0,3,4,5,0,0,0,4,5,8,5,0,0,0,7,5,6,8]; istransition = diff([false, h~=0, false]); transindex = [find(istransitio...

10 years ago | 0

Answered
Performing calculation across large data set
Assuming you're using *R2016b*, this modified function will work straight away with your matrix and single reference functi...

10 years ago | 0

| accepted

Answered
Find centroid of binary image
Either use <https://www.mathworks.com/help/images/ref/regionprops.html#inputarg_properties |regionprops|>: stats = regionpr...

10 years ago | 2

Answered
How do you make a program read a function for a script and creating a function?
Your code is very puzzling. You have for loop using |i| that does nothing: for i = 1:j end %there's nothing ...

10 years ago | 0

Answered
How do I make cell filttering
At a guess, you want all the arrays that contain the number 4: a = {[1 2 3 4] [7 4] [ 3 5] [ 3 6 7 4]} Results1 = a(cell...

10 years ago | 1

| accepted

Answered
Why are strings stored in an extra cell within a table
The reason why |xTable{1,1}| is a scalar cell array is due to the way the data is stored internally in the table. The whole colu...

10 years ago | 0

| accepted

Answered
How to read text table with value in scientific notation and column headers?
The problem with |readtable| is nothing to do with scientific notation. Matlab copes with that with no problem. The problem is t...

10 years ago | 1

Answered
Find specific vector in different text files
filecontent = fileread('DummyText1.txt'); distances = str2double(strsplit(regexp(filecontent, '(?<=Distance.*[\n\r]+)[ 0-9....

10 years ago | 1

| accepted

Answered
how to circular shift table columns
This seems to do what you want: function t = circulartableadd(t, portfolio, maxportfolios) %circulartableadd add a n...

10 years ago | 1

| accepted

Answered
can anyone help to solve this matlab error of not enough input arguments?
Clearly, you've called the function without giving it any input. I.e, you should call the function with: mfcc(somevariable,...

10 years ago | 0

Answered
Basic: Data from Loop in matrix, then XLSwrite
Don't use loops. Learn vectorised operations. %data generation: [x_A, y_A] = meshgrid(x_S:0.1:x_T, y_S:0.1:y_T); A = ...

10 years ago | 1

| accepted

Answered
Can a binary file be opened in matlab and converted to ASCII?
If you don't have any information about the format of the binary file (i.e. documentation from the program that generates it) or...

10 years ago | 1

| accepted

Answered
how to convert column cell to row cell?
cellfun(@transpose, yourcellarray, 'UniformOutput', false)

10 years ago | 3

Answered
Vectorizing multiple string comparison
One obvious minor speed-up is to get rid of the |find| that serves absolutely no purpose. You can directly use the logical vecto...

10 years ago | 3

| accepted

Answered
How can I fix this error - "Error using / Matrix dimensions must agree"
Learn the different between <https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html arrays (eg ./) an...

10 years ago | 7

| accepted

Answered
swaping values in matrix
C = fliplr(B); for i = 1:10000 %twiddle thumbs end I suggest you make an attempt at solving this extremely easy...

10 years ago | 0

Answered
Is there a way to split an array into smaller arrays based on the values in it?
demoarray = [randi([1 10], 1, 50), randi([550 560], 1, 30), randi([1500 1560], 1, 40)]; transitions = find(diff(demoarray) ...

10 years ago | 1

Answered
how to read file a text file with numbers and characters in a loop
There is no generic function in matlab that will magically read this type of file. You will have to parse it yourself, either by...

10 years ago | 0

Answered
Creating an image compression function following MATLAB's example fails, how can I overcome the issue with the inbuilt functions?
Remember that colour images are 3D (height x width x 3) since there are 3 colour planes. Therefore the matrix you receive from |...

10 years ago | 0

Answered
How do you only plot a certain number of results
Apply the same filtering to your x values: xdata = x3(y2 > 0); plot(x, y, xdata, ydata);

10 years ago | 0

| accepted

Answered
Recognizing empty spaces in excel file
[~, ~, raw] = xlsread(somefile, 1); [startrow, ~] = find(strncmpi(raw, 'AMPLITUDE', numel('AMPLITUDE'))); endrow = find(...

10 years ago | 0

Answered
Is it advisable to have a handle object inside a handle object?
Such coupling between two classes is usually indication of a flaw in your object model. Sometimes, it is the most efficient solu...

10 years ago | 0

| accepted

Answered
issues extracting sub matrix
The only safe way to make your expression work for any arbitrary |x| where |min(x)+5| may or may not be greater than |max(x)-6| ...

10 years ago | 2

| accepted

Answered
How to collect information of different cells in a column vector
As Jan says, it's difficult to understand what you want when you don't use valid matlab syntax for your examples. An example con...

10 years ago | 1

Answered
Outlook WordEditor Range.Paste overwrites previous paste
As far as I know, matlab does not understand named constants. You have to use their numerical equivalent which unfortunately is ...

10 years ago | 1

| accepted

Answered
Serial - COM function call basic
Unless you're using R2016b, functions definitions are not allowed in scripts. In earlier versions, functions have to be in their...

10 years ago | 0

| accepted

Answered
how to make a code for distributing n different things among r groups such that each group get atleast certain amount?
machines = 1:7; groupcount = 3; minmachinepergroup = 2; minmachines = minmachinepergroup * groupcount; assert(nu...

10 years ago | 0

Answered
cell entry-function_handler calculation
Your first statement: _"In matrix 'px' store the x-coordinate of P12, P13.(just points)"_ is incorrect. Your |px| is a *cell arr...

10 years ago | 0

Answered
how to add a cell array in another cell array row wise?
cellfun(@plus, A, B, 'UniformOutput', false) will do it. However, I wouldn't use a cell array to store these numbers and in...

10 years ago | 1

Load more