cell merge and print
Maybe something like this? M = [ ... 45 45 65 65 28 28 1 1 9 2 4 1 9 4 7 2 3 1 ]; fprintf([repmat('%d-%d...

7 days ago | 0

| accepted

Find the value of interpolation polynomial
"interpolating f in x = −2,0,2" To me that sounds like you should use f(x) at x = -2, 0, and 2, rather than x = -2:2, which is ...

7 days ago | 2

Problems with declaring the variable right
Using symbolic k1 and xkt1: syms k1 xkt1 xg= 7*2*5*1*6*3; xh= 3/10; F1=3; F2=100; T= 1/500; for i= 0:14 xkt1(i+1...

7 days ago | 0

| accepted

creating uber matrix composed of smaller EEG data matrices (in a for loop): undesired outcome: creates 1 number that repeats in every cell for each subject
Try changing this: tf_all(subno,:,:,:,:) = tf(subno); to this: tf_all(subno,:,:,:,:) = tf;

8 days ago | 1

| accepted

Storing values from inside the third loop to a variable outside the loops
Maybe something like this? a = 2:1:5; b = [1 1.2 2 2.3 3 3.3 4 5]; na = numel(a); nb = numel(b); nc = 3; final_data = Na...

8 days ago | 0

| accepted

Graphing Propagating Electric Field
The only error I ran into was with using axis with symbolic expressions. You can correct that error by changing this line: axis...

8 days ago | 0

| accepted

Help with Table and Row indexing
S = load('predictions.mat'); Predictions = S.Predictions isTruePositive = Predictions{:,'True'} == Predictions{:,'Predicted'};...

8 days ago | 0

| accepted

what is the meaning of (left half plane of roots)?
The left half-plane refers to the part of the complex plane where the real part is less than 0 (or <= 0 if you want to include t...

8 days ago | 1

| accepted

Find function in arrays
yenidendonguyegirecekler = [ -1321.6 -2119.8 -2825.5 -2937.5 -3205.4 -3340.9 -3895.0 -4080.2 -4320.9]...

8 days ago | 1

| accepted

Saving data as binary
k = [0 5 4]; arrayfun(@(x)dec2bin(x,max(1,ceil(log2(x)))),k,'UniformOutput',false)

8 days ago | 0

How to plot 11 curves with colors more than the 7 pre-defined 'y' colors?
When you use Name,Value argument pairs such as 'Color',color1, they must be the last arguments in the call to plot, and they app...

8 days ago | 0

Index in position 2 exceeds array bounds (must not exceed 1).
"Index in position 2 exceeds array bounds (must not exceed 1)." This error message means the code is trying to access a column ...

8 days ago | 0

How to create a matrix with matrices as elements? where the matrix A contains symbolic variables
It may be useful to see the fact that, for matrices A, B, and C of the given sizes, the products C*B, C*A*B, C*A^2*B, etc., are ...

8 days ago | 0

How can I print multiple texts that change using a for statement?
Create the text(s) you need once, before the loop, and then update them inside the loop. % t: 1-by-6 array of text objects % (...

8 days ago | 1

| accepted

is there a way to obtain F(-x) polynomial
Here's a way to do it by operating on the coefficients f rather than the symbolic F(x). Realize that , n even , n odd Theref...

8 days ago | 2

| accepted

I nee to write a code to solve a definite integral. The output format has to be fprintf.
syms x % f = -x.^3 + 3.x^2 - 2; % ^ this . should be * f = -x.^3 + 3*x^2 - 2; a=0; b=3; output = int(f, a, ...

9 days ago | 1

How to select consecutive rows at regular intervals?
% a matrix with 1000 rows and 5 columns M = (1:1000).'+(0:4) One way: A = M((20:50).'+(0:50:end-50),:); disp(A) Another w...

9 days ago | 0

| accepted

when and how to use dot multiplication
"but is .* needed in my above q equation?" Yes. t is a vector, and q0, R, L, and C are all scalars. q0=10;R=60;L=9;C=0.0005; ...

9 days ago | 1

How many legs 100 cows have
n_legs_per_cow = 4; % one cow has 4 legs n_cows = 1000; % 1000 cows n_legs_total = n_cows*n_legs_per_cow

9 days ago | 0

Error message "Index exceeds the number of array elements. Index must not exceed 3"
fsp is the cell array, and fsp{1,1} is the vector contained in the first element (first cell) of fsp. You are taking the length...

9 days ago | 0

| accepted

plotting title with multiple strings on one line
str_cell_array = {"abc\_def.h5" "ghi\_jkl.h5"}; str_title = strjoin(string(str_cell_array)," and ") title(str_title); figur...

9 days ago | 0

| accepted

Applying one function in another function
CreateNeighbor() function sol = CreateRandomModel() sol = struct( ... 'sum_fburn_rand',rand(), ... 'fburn_rand',ra...

9 days ago | 0

May the number of decimal point be related with errors in matlab by using inpolygon and ismember functions?
"I am asking how it is possible?" MagnitudesOfEventsInAreaSource1{i} can have more than NumofeqsinArea1{i} elements if Catalog ...

9 days ago | 0

| accepted

replace specific empty columns by 0 in cell MATLAB?
% reproduction of your cell array: C = repmat({NaN},7,15); C(1:4,11:15) = {0}; C(5:7,5:15) = {0}; C{1,1} = '0.x'; C{2,2} = ...

9 days ago | 0

| accepted

interpreter with backlash underscores
The easiest way to fix this might be not to use an interpreter: subplot(2,1,1) xlim([-1 1]) set(gca(),'XTick',0,'XTickLabels'...

9 days ago | 0

| accepted

How to disable figure pop up while initializing hggroup?
hggroup() creates an hggroup in the current axes in the current figure. If there is no current figure, then a new figure is cre...

9 days ago | 0

Use only a certain range of values for a function
truncated_z = z(t_z <= 3);

9 days ago | 0

| accepted

Matching columns of arrays to fill up a corresponding empty column

9 days ago | 1