Réponse apportée
How to print numbers 1 to 4 and add all numbers to a one array?
Perhaps this is what you want for col =1:1:4 disp(col) a(col) = col; end disp(['a = ',num2str(a)])

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How to create array from saved iterations of a loop
Just store them column by column for jj = 1:1:5 x(jj) = jj end

plus de 4 ans il y a | 0

Réponse apportée
Replace empty string with NaN in a cell
clc;clear;close all; A={ "20" "25" "25" [] "20" [] "25" "25" "25" "30"} % get locations of empty cell elements idx = cellfun(...

plus de 4 ans il y a | 0

Réponse apportée
Create a struct from two cell arrays
keys = {'n', 'key12', 'key13','key14'}; values = {10, 1 1 , 'Hello'}; names = {'f1', 'f2', 'f3', 'f4'}; args=[names;values...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
How does reshape function work? and also how to use sum(A,dim) in the code?
clc;clear;close all % In reshape, the first parameter is the matrix you want to reshape % Second parameter is number of rows ...

plus de 4 ans il y a | 1

Réponse apportée
Specific conditions for array elements
Fairly simple clc;clear;close A=randi(20,5); B = A; % get indices B1 = find(B == 10); B2 = find(B > 10); B3 = find(B < ...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
highlight plot with circle
I do not know if its possible programmatically but you can acheive this using the Insert option of figure window

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
copying specific elements of an array to another.
y = reshape(randn(3)/100,1,[]); idx = 0; for col = 1:1:size(y,2) if (y(col) > 0.001) idx = idx+1; g(idx...

plus de 4 ans il y a | 1

Réponse apportée
Getting error message ' Index in position 1 exceeds array bounds ( must not exceed 4), error in line 7.
You are storing only one element in E. Perhaps you want to copy elements of A into E element by element. A = magic(5) for m=1:...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Find back lost values from an original matrix of derived incomplete column vectors
You did not mention how are you picking the columns. I am assuming that you want columns 1 7 9 14 16 from M. If that's the case ...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How to get back the original matrix with indices of matrix?
clc;clear all;close all A=reshape (1:16 ,4,4); % 4x4 matrix B1 = A(1:2:end, 1:2:end); B2 = A(1:2:end, 2:2:end); B3= A(2:2:en...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
How to select specific entries of a matrix?
I am writing a generic code so you can get an idea how to do what you need (which is how do you pick elements in particular mann...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
How to output a matrix (column by column) after looping
clc;clear all;close all for a=1:1:3 for b=1:1:3 c=a+b; matrix(b,a)=c; % you must store values t...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How to plot circle with text aligned along its circumference
centerX = 0; centerY = 0; Radius = 10; viscircles([centerX ,centerY ], Radius ); % it creates a circle with given parameter...

plus de 4 ans il y a | 0

Réponse apportée
How to request a specific user input?
This is the corrected version of your code prompt = input('Please enter 1 for EXP1 and 2 for EXP2:'); EXP = prompt; % No...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Add up a certain number of consecutive values followed by the next values in a row
clc;clear all;close all A = [1 3 4 0 -1 6]; n = 2; % sum every n elements jj = 0; simdone = true; % to keep while loop runn...

plus de 4 ans il y a | 0

Réponse apportée
Division using for loop
A= [1 2 3 4 5] B = [2 3 4 5 6] for col = 1:1:size(A,2) result(col) = A(col)/B(col); % equal to A./B right division end

plus de 4 ans il y a | 1

Réponse apportée
How to convert all inf values into zero value
A = [3 1 24 inf; 65 21 56 12;inf inf 231 inf;0 12 inf 231]; A(isinf(A)) = 0 % find inf values and replace with 0

plus de 4 ans il y a | 2

Réponse apportée
Linear interpolation two array with target value in one array
I did not check it thoroughly but I think it will work clc;clear all;close all A=[483,427, 306, 195]; B=[0, 0.25, 0.5, 0.75];...

plus de 4 ans il y a | 0

Réponse apportée
how to fill matrix?
I do not think that you can create such a matrix because there is a column dimension mis-match. You can add zero padding to get ...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Sum using for loop
I highly recommend that you go through the link that @Image Analyst shared. Moreover, for adding elements of two arrays (that's ...

plus de 4 ans il y a | 1

Réponse apportée
array element concatenation, blank remove
p=[1,0,0,0,0,0,1,0]; p = sprintf('%u',p); % it is a char p = str2num(p); % converted to double

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
matlab matrix multiple with letter variable
I think storing numeric and character data together is only possible with cell arrays. However, it would be good for storing the...

plus de 4 ans il y a | 0

Réponse apportée
Change eye diagram plot color into black on white
Use set(gca,'Color','white') to change the background color after the plot command

plus de 4 ans il y a | 1

Réponse apportée
I supposed to obtain the result S21/H. I already made the code but the result obtain does not same.
try Pf = S21./H; %probe factor instead of Pf = S21/H; %probe factor

plus de 4 ans il y a | 0

Réponse apportée
Nested if statements under for loop
eval(e) will never be equal to 27.9. To know the reason you have to set the output format from short(default) to long. After doi...

plus de 4 ans il y a | 0

| A accepté

A résolu


Create times-tables
At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...

plus de 4 ans il y a

A résolu


Return the first and last characters of a character array
Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

plus de 4 ans il y a

A résolu


Magic is simple (for beginners)
Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.

plus de 4 ans il y a

A résolu


Finding Perfect Squares
Given a vector of numbers, return true if one of the numbers is a square of one of the other numbers. Otherwise return false. E...

plus de 4 ans il y a

Charger plus