Answered
Plot multi curve in one figure
The function plot from the Curve Fitting Toolbox does not have the same set of options as the function plot from base MATLAB. h...

4 years ago | 0

| accepted

Answered
How can I plot loglog graph for a black body spectrum by taking frequency as x axis in matlab
h =6.626e-34; c = 3e8; k= 1.38e-23; T=[3000,5000,10000,20000,30000]; nu=linspace(1e9,1e19,100); % B=(2*h*nu.^3/c.^2)/(exp(h...

4 years ago | 0

Answered
print value to matrix
V_new = []; for ii = 1:max_iterations % calculate V V_new(:,ii) = V; end Also, if you know ahead of time how many i...

4 years ago | 0

Answered
Auto save file in running GUI
Maybe you can use a timer for this. (https://www.mathworks.com/help/matlab/ref/timer.html) You could create the timer in the Op...

4 years ago | 0

| accepted

Answered
I'm getting an error using: ver_4/singleButtonPushed The index in position 1 is invalid. Array indices must be positive integers or logical values.
Suppose result_conv is of size 2-by-2 and x is 1 and y is 1. Then all the if conditions are met, so the for loops are executed. ...

4 years ago | 0

| accepted

Answered
MATLAB Table - Unique lookup from multiple instances
TABLE1 = table( ... {'a';'a';'a';'b';'b';'c';'c'}, ... [3;3;3;9;9;27;27], ... 'VariableNames',{'col1' 'col2'}) T...

4 years ago | 0

| accepted

Answered
connecting lines between adjacent scatter plots
"Does it require a loop?" No. "How to do this?" % Your data X1 = rand(30,1); X2 = rand(30,1); Y1 = rand(30,1); Y2 = rand(...

4 years ago | 1

| accepted

Answered
Histogram adds occurrences of highest two values together to one bar instead of showing them separately.
Yes, this is the expected behavior. From the documentation for histogram: "Each bin includes the left edge, but does not includ...

4 years ago | 1

| accepted

Answered
I need to pass from a text file to a matrix in Matlab
You say you want a matrix that contains stuff like the number 6 as well as the string "Ben" (or the character array 'Ben'). That...

4 years ago | 0

| accepted

Answered
I can't get input a trigonometric expression
u = input('Enter the function to be integrated: ','s'); f = str2func(['@(x)' u]);

4 years ago | 1

| accepted

Answered
Accounting for the missing string using the number zero
Here's a way to do what I think you want to do, with minimal changes to your code (although I added some comments about some thi...

4 years ago | 1

| accepted

Answered
How to make a two-dimensional mask act on a three-dimensional array?
You can replicate your matrix D=any(isnan(B),1) in the first dimension using repmat, generating a 3D logical array the same size...

4 years ago | 0

Answered
max value of N arrays
You say they're column vectors in the description, but the example uses row vectors. It doesn't really matter, you can do it eit...

4 years ago | 0

| accepted

Answered
If statement not replacing matrix elements correctly
I think you mean: cpoffcorr = zeros(1,simnum); % yes, pre-allocate for i = 1:simnum if cpoff(i) > 0 % check the ith eleme...

4 years ago | 0

| accepted

Answered
How to add legend (or colorbar) to volshow/labelvolshow output?
Maybe something like this can be a start: volume_labeled = randi(10,[5 5 5]); view_panel = uipanel(figure,'Title',"Titolo");...

4 years ago | 1

| accepted

Answered
Reordering legend items deletes legend handle - how can I get them back?
Maybe you will have better luck modifying the order of the lines and their names in the call to legend, rather than reordering t...

4 years ago | 0

| accepted

Answered
how to extract data from ascii file?
data = readmatrix('qwer.txt') plot(data(:,1),data(:,2),'.-') "in this file around 2000 data is present ...and i need only 1001...

4 years ago | 0

Answered
How to extract only first peak of each pulse (positive or negative) in sequence throughout the signal
load Example.mat data = C; t = 1:length(data); [p,s,mu] = polyfit((1:numel(data))',data,1); fn = polyval(p,(1:numel(data))...

4 years ago | 0

| accepted

Answered
Can you have a multilevel table?
You can use 'MergeAsTable',true in mergevars: load patients T1 = table(LastName,Gender,Age,Height,Weight,Systolic,Diastolic); ...

4 years ago | 1

| accepted

Answered
Set length of plot axis
You can use axis padded x = -1:0.1:1; y = 2.5-x.^2; plot(x,y) axis padded Or set the y-limits: x = -1:0.1:1; y = 2.5-x.^2...

4 years ago | 1

| accepted

Answered
How to loop through each row of a column, then loop through the remaining columns?
Replace: response = group1_responses{j}; with: response = group1_responses{j,i};

4 years ago | 0

| accepted

Answered
i am not getting plot
lp seems to always be a 1-by-3 vector and p1 is a scalar. Therefore plot(p1,lp) creates three lines, each with one point. You ...

4 years ago | 0

Answered
how to fix this error "Dot indexing is not supported for variables of this type"
It means kernel_param is not a struct. Here kernel_param is a struct, so it works fine: kernel_param = struct('nuser',0,'nmovi...

4 years ago | 0

Answered
I need to format a text file
It's not clear whether you need any of those intermediate results or just the final result, but here's one way to do everything:...

4 years ago | 0

| accepted

Answered
Update multiple values in a struct array
This works whether the field is a scalar in each element of S or not: S = struct('value',{[1 2 3] [2 3; 4 5] [] 6}); % initial ...

4 years ago | 0

Answered
How to subplot 2 constellations with scatterplot (and NOT "scatter plot")
As far as I can tell, there is no way to use scatterplot to create a scatter plot in a subplot (or in any axes other than the on...

4 years ago | 1

| accepted

Answered
Does MatLab designer support inserting Text fields and CheckBoxes inside a ListBox?
As far as I know, there is no support for nested controls. Maybe using a uitable would work for what you want to do (synchroniz...

4 years ago | 0

| accepted

Answered
How can I change the numbers to negative without altering the positive ones and make a sum of that? This is the serie 1-2+3-5+8-13+21-34+...
n=8; F=[1 2]; % suma=0; for i=3:n F(i)=F(i-1) + F(i-2); end disp(F) F(2:2:end) = -F(2:2:end) cumsum(F) sum(F)

4 years ago | 0

| accepted

Answered
Scatter plot with strings on x axis
sites = compose("%s%d",["J" "Ju" "P" "R" "S" "W"].',1:5).'; sites = sites(:); sites([12 14]) = []; n_sites_per_group = [5 5...

4 years ago | 0

| accepted

Load more