Answered
Hello! I want to generate some dynamic variables using for loop. can anybody help?
Don't use dynamic variable names. It looks like you would benefit from storing your data in a [n-by-m] cell array like this: n...

7 years ago | 0

Answered
Counting zeros in array
Loop method input = [1 -2 -1 -1 -1 0 0 -1 0 0 0 3 0 0 4 0 0 0 0 0]; output = nan(numel(input),2); for i = 1:numel(input) ...

7 years ago | 1

| accepted

Answered
Error using fseek - while running the matlab code. Input to the program looks fine.
I don't know what inputs are expected for your custom function but the error is happening because fseek() expects a file identif...

7 years ago | 1

Answered
Count numer of lines in a MATLAB script, ignoring comments and blanks
Try this out. After reading the entire file, separated by line, it removes any leading white space, then gets rid of empty line...

7 years ago | 1

| accepted

Answered
split big metric into small ones
"how to divide a (513*513) matrix into smaller 29241 (3*3) matrices ?" "mc" below is a 171 x 171 cell array of your 29241 sub-...

7 years ago | 0

| accepted

Answered
How can i get value from pop up menu
The "value" property of a popup menu indicates the user's selection by returning the index value (an integer). The "string" pro...

7 years ago | 1

| accepted

Answered
Adjusting the dimensions of input argument
A = reshape(A,1,[]); The above will transpose a column vector or will leave a row vector as is. A quick note on the use of "...

7 years ago | 1

Answered
how to clear ui control callback error
In this line x1=handles.metricdata.x1; "x1" is not a field within the structure "metricdata". "metricdata" is most likely a ...

7 years ago | 0

Answered
Can I use the Jacobian provided by 'lsqnonlin' to compute the confidence intervals using 'nlparci'?
Yes, you can use it but see Matt J's warning about using bounded constraints. [estParams,~,residual,~,~,~,jacobian] = lsqno...

7 years ago | 1

| accepted

Answered
World mystery!How can i stop all the sub-functions immediately?
What about something like function stop_callback(~,~,~) error('User stopped execution') end

7 years ago | 1

Answered
How do I assign the value of a matrix to a cell of an object "uitable" ?
Assuming "TablaDatosElementos " is the handle to your uitable, you must assign the value to the 'Data' field. TablaDatosElement...

7 years ago | 0

Answered
How to insert an element after each number in a vector?
result = [reshape([ones(size(a));a],length(a)*2,1);1]';

7 years ago | 1

Answered
How can I measure the time it takes to run different sections of code in MATLAB AppDesigner?
Use matlab's profiler. Start from a clear workspace, start the profiler, initialize the app, then view the results. profile o...

7 years ago | 3

| accepted

Answered
Underscore doesn't work for step legend
The escape character (\) is mistakenly added in legend() > setDisplayNames() even though the latex interpreter is correctly assi...

7 years ago | 3

| accepted

Answered
Storing Data from an IF loop
There is no such thing as an 'if loop'. There are while loops and for loops but an 'if' statement is a conditional. If white...

7 years ago | 0

Answered
How to determine whether any elements of an array are a certain a number
Convert the matrix into a vector using (:) and then use any() to determine if there are any values of -2. while any(A(:)==-2)...

7 years ago | 0

Answered
cannot send an email through matlab
Mario, follow this demo on how to send an email from a gmail account using matlab. You're close - you just have to make some s...

7 years ago | 0

| accepted

Answered
Plot histograms of two samples as plots
"I would like the histogram to be a plot rather than histogram with boxes." Option 1: Draw line at the center, top of each bar ...

7 years ago | 0

| accepted

Answered
Display data points in boxplots
After some slight rearrangement of your code, I added a secton that optionally scatters the x coordinates around the centers of ...

7 years ago | 4

| accepted

Answered
Find columns with same values in matrix
I changed your example matrix to include a variety of duplicates. % Example: A = [2,2,7,3,5,0;8,7,8,10,5,0;4,3,5,3,9,0;6,7,1,...

7 years ago | 0

| accepted

Answered
Counting consecutive occurences of 1s and -1s
The first step below counts all consecutive numbers. The second step eliminates the 0-counts. A = [0 0 1 1 1 1 0 0 0 -1 -1 -...

7 years ago | 1

| accepted

Answered
How do I adjust legend fontsize after changing legend marker size?
The only currently supported output to legend() is the legend handle (link to docmentation). Starting in R2024b, calling legend ...

7 years ago | 2

Answered
Plotting yyasix in Matlab from csv file
See my 3 comments to understand the changes I made. plotData = importdata('pce and power at 10k for lvt.csv') plotData.colhead...

7 years ago | 0

Answered
Issue with XTicks and XTickLabels in App Designer
Your code is fine. I think you're assuming the tick interval is 5 hours because there are 5 minor grid lines in each interval. ...

7 years ago | 0

| accepted

Answered
Changing the scale of axis in surf plot
How to change the limits and ticks on the x axis h = surf(X,Y,Z); % save handle to surface object axHand = h.Paren...

7 years ago | 0

| accepted

Answered
Plotting a cell as a plot
Here's an alternative (without loops) figure hold on cellfun(@(x)plot(x(1,:),x(2,:)), trac_speed) Demo: % Create fake data ...

7 years ago | 0

Answered
Is it available to change the end of a loop for inside it?
You want to use a while loop for this purpose. It might look something like this (tough to tell without seeing more of your c...

7 years ago | 2

| accepted

Answered
setting array to edittext with Matlab GUI
(Continuing from comment section under the question) No for-loop needed. set(handles.edit8,'string',num2str(t))

7 years ago | 0

Answered
Multiple y axes on single x axis
Try a function from the file exchange https://www.mathworks.com/matlabcentral/fileexchange/9016-addaxis https://www.mathworks....

7 years ago | 10

| accepted

Answered
How do I make my plot show more than one point?
Use hold . You don't need for-loops. figure axes hold on path =1; if path == 1 x1 = 0 : 0.2 : 5; y1 = (x1.*2)...

7 years ago | 0

| accepted

Load more