Answered
How to set all duplicated rows to be zeros
I'd stay with unique() and then pad the rest with zeros. queue=[1,2,3;2,3,4;3,4,5;1,2,3;2,3,4;3,4,5;0,0,0;0,0,0]; sr = sortr...

7 years ago | 1

Answered
How to vary the color of a dynamic line?
There are a few ways around this (see this answer for demos). One way is to plot the line in segments such that each segment ca...

7 years ago | 1

| accepted

Answered
Is there any way to "clean" a single row of a uitable?
To clear a list of rows from a table, copy the entire table into a local variable, empty the desired rows, and then reassign the...

7 years ago | 0

| accepted

Answered
FROM STRING TO ARRAY
From char to cell array of characters x = 'ABCDE'; y = num2cell(x); y = 1×5 cell array {'A'} {'B'} {'C'} {'...

7 years ago | 0

Answered
Correlation between two vectors
Directly from matlab documentation, n = 0:15; x = 0.84.^n; y = circshift(x,5); [c,lags] = xcorr(x,y); stem(lags,c) xlabe...

7 years ago | 1

| accepted

Answered
How to split string
Use regexprep() c = {'Group' 'Sub_group' 'Name' 'Date' 'Value'; 'Group1' 'S1Gp11' 'HATU' 'R20...

7 years ago | 1

| accepted

Answered
restart an app with code
I agree with Guillaume that closing and reopening an app might be a red flag that something is being done suboptimally (or worse...

7 years ago | 6

Answered
Highlight 3 points in scatter plot with label on it
There are several ways to go about this such as by using text(), annotation(), gname(), labelpoints() and other methods. Here's...

7 years ago | 0

| accepted

Answered
How to specify limit of right y axis, and add values above bar
Starting 2016a, you should use yyaxis() instead of plotyy(). figure1=figure; E = [31 15.5 72.2 36 71.6 700 590 610;zeros(1...

7 years ago | 0

Answered
Plotting different colors of Bar graph (2016a)
" I have been trying to plot bar with different colors" For newer releases, this is fairly straightforward (demo) but for r201...

7 years ago | 0

| accepted

Answered
kmeans Too many input arguments.
Option 1 The best solution is to rename all of your custom kmeans() functions with unique names. Custom functions should gener...

7 years ago | 1

| accepted

Answered
Edit colorbar of heatmap (string)
This can't be done with heatmap() (see comments under the question). If you're using a different function that allows access t...

7 years ago | 2

| accepted

Answered
Why should i not use msgbox in App Designer?
uialert() was designed to work will app designer and has several nice features. For example, the first input to uialert is th...

7 years ago | 2

| accepted

Answered
Sum of first column based on second column and storing results in a matrix
% Create fake data for the demo A = [rand(30,1),randi(3,30,1)+1000]; % Calculate group sum and store in table [groupID, gr...

7 years ago | 1

| accepted

Answered
How can I remove the white edge in the density map?
Try this axis tight xlim([minvalstri(1), maxvalstri(1)]) ylim([minvalstri(2), maxvalstri(2)]) Note that these points are the...

7 years ago | 1

| accepted

Answered
Fix a colormap between two values
"I would like to "fix" the colorbar between two handpicked values [depthMin depthMax], so that the first image is generally blue...

7 years ago | 1

| accepted

Answered
adding labels and automatically saving as .jpg
" i would like to add x and y labels to the figure and automatically save it as .jpg without displaying the figure " You can s...

7 years ago | 0

| accepted

Answered
why the these two equal values when comparing gives 0 as result ?
6.00000001 == 6 ans = 0 To see if precision is the issue, one or both lines below should be false. fsern(221) ==...

7 years ago | 0

Answered
File name as value of a variable
You were really close. You just forgot to use the filename variable. for i=1:5 filename = sprintf('testdata_%d.xlsx',i); ...

7 years ago | 4

| accepted

Answered
How to use extract values from table and create a vector?
Reshape your matrix from [n x 6] to [m x 3] where m=2*n. Row 1 of your new matrix will be your V1 vector, row 2 will be your V2...

7 years ago | 1

| accepted

Answered
date conversions from yyyydddhhmmss to the number format
Assuming you've already isolated the datetime strings, % Convert string to datetime dtstr = '2018:335:00:00:11'; dt = datet...

7 years ago | 0

| accepted

Answered
How to get the value of Radio buttons from App Designer
The 'Value' property of the radio buttons returns a logical that is true when selected and false otherwise. Here's an example t...

7 years ago | 5

| accepted

Answered
How can I plot in real time where I have a circle be the current position, and I also have a line of every past position?
Option 1 Here's a demo to run that plots the progression of a curve as a line with a circle marker at the current coordinate. A...

7 years ago | 0

Answered
How to access large arrays
"How can I view all the entries in this array" One way is to put the char array into an edit box where you can scroll through ...

7 years ago | 0

| accepted

Answered
Index exceeds the number of elements (1)
On the second iteration of your while-loop, u2(i) is causing the error since you're trying to access the second element of u2 bu...

7 years ago | 1

Answered
How can I call RGB triplets within my for loops from a predefined structure?
%This line is fine r = [[0, 0.4470, 0.7410]; [0.8500, 0.3250, 0.0980]; [0.4660, 0.6740, 0.1880]; [0.6350, 0.0780, 0.1840]]; ...

7 years ago | 1

| accepted

Answered
mean of tables in cells
You can adapt this functional demo to your needs and if it doesn't work with your data, please tell us how your data differ from...

7 years ago | 0

Answered
Random Noise Generation Error
You're running 96256 total loops which will take a while. It looks like you terminated the process while waiting. To see the p...

7 years ago | 1

Answered
How to add equation to function
Try using an anonymous function. I also cleaned up the for-loop so it is used properly. rocketFcn = @(x)(60+(2.13*(x^2))-(0.0...

7 years ago | 1

Answered
Matlab doesn't write on excel after the first loop in try catch
Without having much information, your error is probably due to improper loop setup. for f = 1:size(Flist) size(Flist) probabl...

7 years ago | 1

| accepted

Load more