Réponse apportée
Using strings as variable names in a for loop
You can use eval(['C=zeros(' myvar ');']) But it would be much simpler to code k = [20, 30]; for i = 1:numel(k) ...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
Encrypting a message in matlab?
If you use input with the 's' argument, it will return a string. For the key you need a number, so use key=input('What will...

plus de 10 ans il y a | 0

Réponse apportée
How to find the indices of a point on a curve
If y is your curve, in general you will not have values that are exactly 0.707 of your maximum. So the idea is to use the 2 valu...

plus de 10 ans il y a | 0

Réponse apportée
Sum of some elements in two separate vectors
[uA a b] = unique(A); sB = arrayfun(@(x) (sum(B(b==x))), 1:numel(a)); X = [uA sB'];

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
simple error on plotting
It works for me. Try clear test2 and look which plot function you are actually using which plot BTW: linspace...

plus de 10 ans il y a | 0

Réponse apportée
Optimizing a Sliding Window for Matrix Re-Assignment
If you have the image processing toolbox, you can use: stdA3 = colfilt(A, [3 1], 'sliding', @std);

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
In an assignment A(I) = B, the number of elements in B and I must be the same.
You cannot assign a 1x2 matrix [-1 1] to a single element A(k) of a matrix. It is not clear to me what you want to achieve w...

plus de 10 ans il y a | 1

Réponse apportée
assigning a vector to a function
It seems that you have not defined your function properly. In an m-file called myfun.m you write function A = myfun(X,Y) ...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
conversion of a date/time column into serial date number and seperate time column
s = '20050103 014800'; dat = datenum([s(1:8)], 'yyyymmdd') min = sscanf(s(10:11), '%f')*60 + sscanf(s(12:13), '%f')

plus de 10 ans il y a | 1

Réponse apportée
Reshape 2D matrix to 3D using time as 3rd dimension
If i is your related to your time and takes values 1,2,3, etc, and A is the n x n matrix at time point i, you can use: B(:...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
How to find the indexes of a matrix which has zero elements as well
It is not entirely clear to me what you want. The linear indices of a matrix A are reshape(1:numel(A), size(A)) To fi...

plus de 10 ans il y a | 0

Réponse apportée
How to write in short form?
If you know that the SDED are numbered from 1 to 12: s = sprintf('SDED%d, ', 1:12); eval(['SDED = vertcat(' s(1:end-2) ');...

plus de 10 ans il y a | 0

Réponse apportée
why eigenvalue of 3x3 matrix is showing complex value when its a22 element was changed from 180 to 179.99?
A real matrix can have complex eigenvalues, that's fine. <http://www.math.utk.edu/~freire/complex-eig2005.pdf>

plus de 10 ans il y a | 1

Réponse apportée
How to filter out useless data
iv = data(:,3); % implied volatility, assumed to be stored in column 3 idx = isnan(iv) | iv > 1; % logical array of indices ...

plus de 10 ans il y a | 0

Réponse apportée
Standard Deviation from a certain point
Your program is fine. After the loop, you just have to compute i1 = find(NUMBER == floor(N/2), 1, 'first'); std(NUMBER(i...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
How do I add a string to a cell?
C{1,5} = 'newstring';

plus de 10 ans il y a | 1

| A accepté

Réponse apportée
About PCA and 'manual' decomposition
This is discussed here: <http://stackoverflow.com/questions/18152052/matlab-eig-returns-inverted-signs-sometimes>

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
Ao can I display a var-comment-var ?
If A and B are numbers, you can use disp([num2str(A) ' my comment in between ' num2str(B)])

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
Read two matrices from CSV file then add them together
You can read the matrices using dlmread. After you've done this, what is the size of A and B? It must be the same. Basically, it...

plus de 10 ans il y a | 0

Réponse apportée
could anyone please tell that what is the exact explanation for function ------> data = data(1:15000,2)'
You select rows 1:15000 from column 2 of your data matrix and transpose it (using '), and store it in data. Before this operatio...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
NEED HELP! In an assignment A(:) = B, the number of elements in A and B must be the same.
a(k,:)=DataHash(k, Opt);

plus de 10 ans il y a | 0

Réponse apportée
Hi,how can I remove red circle places
You can specify the coordinates of a rectangle that covers the part you want to remove and set it to 0, e.g., for the upper left...

plus de 10 ans il y a | 0

Réponse apportée
How to convert Lab to RGB image and its matlab code?
help cform tells you rgb = imread('peppers.png'); cform = makecform('srgb2lab'); lab = applycform(rgb, cform);

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
Why can i not plot this?
You don't need the for loop, but you have use ./ before (x.^2*S)): x = 1:10; % no need to use :1:, 1 is the default increme...

plus de 10 ans il y a | 0

Réponse apportée
Convert the contents of array to char
s = char(bin+'0')

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
Anyone know how to display the degree symbol?
text(0.5,-0.11,sprintf('preferred orientation: %d%c, phase: %d%c',30,char(176),60,char(176)))

plus de 10 ans il y a | 0

Réponse apportée
Why does strtok cut too much out of my string?
This is because you specify a set of delimiters in the second argument of the strtok function, and 'D' is a delimiter. Leading d...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
How to save a structure as .mat?
for subfolderidx = 1 : length(subfolderinfo) subfolderi = subfolderinfo(subfolderidx).name thissubfolder = fullfile...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
How to create addition loops
The arrayfun generates the N numbers, and the sum sums over these numbers: N = 4; % sample value x = sum(arrayfun(@(x) (su...

plus de 10 ans il y a | 0

Réponse apportée
Monte Carlo stimulation about gamble
You can use this code money = [5 12]; while ~any(money == 0) player1wins = rand(1,1) > 0.5; if player1wins ...

plus de 10 ans il y a | 0

Charger plus