Answered
Generating matrix of integers with distinct rows
In this method, we'll assign a random permutation to each row, row-by-row, and if it's not a different set of integers than the ...

7 years ago | 0

| accepted

Answered
Define multible Global Variables
Maybe it's a sign from the god of "Best Practice" to not use global variables ;) Your declarations should (still) work. Don...

7 years ago | 2

Answered
Create a vector of vector exponents
No loop method: m = cell2mat(arrayfun(@(x)v*A.^x,1:n,'UniformOutput',false)') Test result with loop version mm = zeros(6,5); ...

7 years ago | 0

Answered
group every ten cell array
c = cell(1,180); % the original 1x180 cell array newCell = mat2cell(c,1,repmat(10,1,18)); %the new nested cell array

7 years ago | 0

| accepted

Answered
use 'enable' in ui table
geeks g is refering to UItables (from previous discussions). Read about the 'enable' property here: https://www.mathworks.c...

7 years ago | 0

| accepted

Answered
How to copy data from one timetable to another
Is there a simple function to do that? Yes: synchronize() Is it a problem that the date format isn't the same? As long as...

7 years ago | 0

| accepted

Answered
GUI uitable logical values
"SO I HAVE this ui table i want to select sujects and push 'submit' to calculate the sum of credit for the subject i selected" ...

7 years ago | 0

| accepted

Answered
Scatter plot with a color variation based on a third vector
Use gscatter() (grouped scatter) %Define thesholds thresholds = [4000, 4800]; pointsize = 30; group = ones(length(Supply)...

7 years ago | 2

| accepted

Answered
multi bar labeling plot
Here's how to locate the center of each grouped bar and label them. Starting in Matlab R2019B, the center of each bar is stor...

7 years ago | 0

| accepted

Answered
Plot text box question
text(0,800,sprintf('n=%d',n) %for integers text(0,800,sprintf('n=%.3f',pi) %for non-integers (showing 3dp)

7 years ago | 0

| accepted

Answered
How could I fix the axes in heatmap in Matlab? or set MaxColorValue?
The Min / MaxColorValue parameters didn't appear until r2019a. The documentation in r2018b and prior makes no reference of thes...

7 years ago | 1

| accepted

Answered
How to create tab-separated .txt using num2str
If you're using r2019a, use writematrix(). DistMatrix = magic(16); % fake matrix 16x16 fn = 'Leng...

7 years ago | 0

| accepted

Answered
How can I transform two values separted by _ of one colum in two columns?
Here's a one-liner. No loop needed. xy = cell2mat(cellfun(@str2num, strtrim(regexprep(F,'[^0-9.]',' ')), 'UniformOutput', fal...

7 years ago | 0

Answered
print a circular disk onto my graph
Ironically, you can use the rectangle() function with 100% curvature to plot a circle. The position property specifies the lo...

7 years ago | 2

| accepted

Answered
Drawpolygon starting at a certain point ?
The starting coordinate and number of vertices cannot be controlled by drawpolygon(). However, you can control whether the poly...

7 years ago | 0

Answered
close of an invalid figure handle
I can't speculate why it throws an error rather than a warning but here's a workaround that will close a figure if the handle is...

7 years ago | 0

Answered
Hello my dear,How can I write this error? Thank all.
These aren't errors. They are warnings. Your variables isq, isd, frq, frd and wr are created within a loop and on each iterati...

7 years ago | 1

Answered
How can I fill area above a plot?
Here you go (applied to fake data); let me know if you have any questions. % Create fake data Freq1 = 1:100; Gain_Upper = ...

7 years ago | 0

Answered
Hi guys, I'm trying to create a multiwindow app. It's my first app but I'm taking this error. How can I solve it?
I beleive your error is here % Code that executes after component creation function startupFcn(app, MainApp, a, b, c) ...

7 years ago | 0

| accepted

Answered
How to print this box in MatLab?
As dpb mentioned, you need to indicate when to move to the next line (which is only done at the very end of your code). Here's ...

7 years ago | 1

Answered
Not enough input arguments
The integral function integrates your function from u=0 to u=T but you never provide values for "t" or "eq" which are the 2nd an...

7 years ago | 0

Answered
complex string match with regexprep
Here you are. str='diff([v0(k-1,2)-v0(k-1,1) v(2)-v(1)])/diff(t0(k-1:k))+((v(2)-0)*diff(t0(k-1:k))+sum((v0(2:k-1,2)-v0(2:k-1,10...

7 years ago | 0

| accepted

Answered
Modify function to take input argument of marker
I don't recommend editing the source code because 1) you'll have to repeate those edits every time the file is updated and 2) it...

7 years ago | 1

| accepted

Answered
How can one specify a cell array or string array when your message has multiple lines of text?
Here's are 3 examples that all produce the same confirmation figure. Input: Cell array f = uifigure; msg = {'This is line 1 ...

7 years ago | 1

| accepted

Answered
Extract scattered data from fig
Here is a cleaned-up version of your code that finds any and all objects in the specified figure that contain an "XData" propert...

7 years ago | 0

| accepted

Answered
How to subtract two plots with irregular x-value spacing
I would interpolate the data to specific x values for both lines. https://www.mathworks.com/help/matlab/ref/interp1.html Sin...

7 years ago | 2

| accepted

Answered
How to increase xticks to axis
Your code should already by providing annual ticks. Nevertheless, here are some improvements. y_data=rand(1,19); x = 1995:1:2...

7 years ago | 0

| accepted

Answered
finding/changing name of timetable 'Time'column
Idea 1: No need to change the name If you're trying to access the time stamps, you don't need to know the name of the time colu...

7 years ago | 8

| accepted

Answered
Find nearest neighbors between points of 2 matrix (x,y)
The simplest and best solution IMHO is to stick with the basics: the Pythagorean distance formula in a loop. % Create some fak...

7 years ago | 1

| accepted

Answered
can we determine input varibles accuracy in genetic algorithm?
You can round the numbers to one decimal place like this. round(x*10)/10 Also note the 2nd optional input to round() sinc...

7 years ago | 0

| accepted

Load more