Community Profile # _

Last seen: Today Active since 2013

#### Statistics

All
• • • • • • • • • • • • #### Content Feed

View by

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 hours ago | 0

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...

18 hours ago | 0

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(...

18 hours ago | 0

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...

19 hours ago | 1

| accepted

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...

2 days ago | 0

| accepted

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

2 days ago | 1

| accepted

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...

2 days ago | 1

| accepted

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...

2 days ago | 0

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...

2 days ago | 0

| accepted

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...

2 days ago | 0

| accepted

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");...

2 days ago | 0

| accepted

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...

2 days ago | 0

| accepted

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...

2 days ago | 0

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))...

2 days ago | 0

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

2 days ago | 1

| accepted

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...

3 days ago | 1

| accepted

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};

3 days ago | 0

| accepted

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 ...

3 days ago | 0

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...

3 days ago | 0

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:...

3 days ago | 0

| accepted

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 ...

3 days ago | 0

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...

3 days ago | 1

| accepted

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...

3 days ago | 0

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 days ago | 0

| accepted

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 days ago | 0

How to Plot data groups with different colors?
One way is to plot one line per depth interval, each with a different Color/MarkerFaceColor: % first, I make up some random dat...

4 days ago | 0

| accepted

Selecting rows periodically from csv data file.

4 days ago | 0