Réponse apportée
Hello, I keep getting an error about undefined unary operators. I don't understand this error and I don't know what else I am missing.
I would suggest splitting up K in smaller parts. Currently it is extremely easy to make a mistake, and it is about as hard to sp...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
function doesnt works well
varargin is typically used to capture optional input arguments: help varargin Since you don't use the optional/unnamed inputs,...

plus de 4 ans il y a | 0

Réponse apportée
coordinate data in the text command
You have two options that I'm aware of: Write a wrapper function that will split your vector as approriate. Use a comma separa...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How to make dynamic variable names (A1, A2, A3, ..., ) with "for" loop?
Don't use numbered variables. Use cell arrays instead. I also changed your loops to use n instead of i and j (as they can be cof...

plus de 4 ans il y a | 2

| A accepté

Réponse apportée
Problem with Plot function.
You have added ',2' twice. If you remove those, it should be a valid syntax.

plus de 4 ans il y a | 0

Réponse apportée
how to use a 'loop' for certain counts
You were attempting to overwrite elements of your array. You were also trying to create numbered variables, instead of using ar...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How to use genvarname variable after creation?
This is a terrible idea. You are forced to use eval every time. The only time you wouldn't need eval is if you are using it t...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Problem to display output
You're trying to index b. So let's explore the values involved: %rest of your code for i = 1:200 b = trans_matrix^i; ...

plus de 4 ans il y a | 0

Réponse apportée
plotting discrete graph from 0 to 20
You should be using plot with only the markers then. plot(0:20,ones(21,1),'*')

plus de 4 ans il y a | 0

Réponse apportée
from python to matlab
You have three options. Re-implement the entire functionality in Matlab. There is no automatic conversion possible. Call you P...

plus de 4 ans il y a | 0

Réponse apportée
how to zoom file.mat
When you use load with an ouput argument, you will load the variables in that file to a struct. Based on your error message, I'm...

plus de 4 ans il y a | 0

Réponse apportée
How can I convert a char vector according to the readtable VariableNamingRule
Yes, there is: S='123 Character?Vector_With*Special Characters_'; N = matlab.lang.makeValidName(S) If you want to make sure...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
How would you find the missing dates. This code only gives one of the missing dates
doc ismember

plus de 4 ans il y a | 0

Réponse apportée
I want to find the average of the months in the graph, pls help
You should not store data in variable names, so DateMar is not a good name. It prevents you from extending this code easily to l...

plus de 4 ans il y a | 0

Réponse apportée
Windows script does not run under macOS Monterey
It looks like you are mixing \ and /, which might cause issues. In general you should use filesep or fullfile to create a path ...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Minimize squared error function with fmincon
fmincon promises to minimize the function value if you provide it with a vector. So the solution is to have a wrapper function t...

plus de 4 ans il y a | 0

Réponse apportée
Color of legend does't change in the loop.
Each call to fplot will create a line object. So in your code you create 4 objects, but you provide only 2 legend entries. syms...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Add row in a matrice
You did nothing wrong. You only forgot that using the semicolon (the ; symbol) will suppress the output of a function. That is ...

plus de 4 ans il y a | 0

Réponse apportée
Conversion of grayscale image into RGB and CIELAB color space
To convert a grayscale image to RGB you need a colormap. G=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_fil...

plus de 4 ans il y a | 0

Réponse apportée
find number of zeros in an array
Get the RunLength function by Jan from the file exchange.

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Find the occurances of the 'nth' digit matlab
You hardcoded the fact that your first input must have 100k elements (without documenting this). You are also using str2num, whi...

plus de 4 ans il y a | 0

Réponse apportée
error using inlineeval (line13)
Why are you using an inline object instead of an anonymous function? Anyway, the reason is the ^^ in your function definition. ...

plus de 4 ans il y a | 0

Réponse apportée
how to create checkboxes in appdesigner based on number of specific files present in the folder?
You can create uicheckbox objects in a loop in your code, depending on a list of files. See the documentation here.

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How to extract elements from cell arrays and compute the mean of those elements?
By far the easiest way is to use a loop. SubB_M1power={rand(128,3),rand(128,3)}; for n=1:numel(SubB_M1power) SubB_M1power...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Why won't fitpeaks work on my data?
I guess boldly: Your txt file contains both the magnitude and the wavelength. The plot function gave you a plot with two lines:...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
display table in command window without { }
If you really want to, you can. The formattedDisplayText function was introduced in R2021a. I read about this one in a Communit...

plus de 4 ans il y a | 2

Réponse apportée
How to generate two random where the distance between is within a range
If you need a uniform distribution you might need to randomly generate pairs of deltaX and deltaY until hypot(deltaX,deltaY) is ...

plus de 4 ans il y a | 0

Réponse apportée
plot a function of 2 variables inside a for loop
You are overwriting J and using j in your loop definition. You should define an array to hold the result. Then you can define...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How to add colormap on an image?
In case you don't want to make a screenshot of your image with print, you can use ind2rgb: a=imread('moon.tif'); map=colormap(...

plus de 4 ans il y a | 0

Réponse apportée
How to define an objective function in the fmincon?
Your objective function should return a scalar. To borrow a term from machine learning: it is a cost function. One of the often...

plus de 4 ans il y a | 0

Charger plus