Réponse apportée
( need help ) nested for loops to print the following pattern
You have it almost right but I'd suggest to use for-loops for indexing through rows(lines) and columns(individual character). Al...

plus de 8 ans il y a | 0

Réponse apportée
how to split cell array values into two columns?
one way: C = {[2.13949546690144;56.9515770543056]}; A = round([C{:}].'*100)/100 A = 2.1400 56.9500

plus de 8 ans il y a | 0

Réponse apportée
Hello guys, I have a question concerning my Matlab script. I try to read/load several pictures but I always get the same error. Could anyone have a quick look at my script? The files I try to load defintely exist and they all have the .jpg format.
Probably you're not working on the same directory. Try using fullfile, bild = imread(fullfile(affectivepictures(i_pics).path...

plus de 8 ans il y a | 0

Réponse apportée
How to call/run a .m file by selecting a menu bar item from main .m file
use its *callback* <https://de.mathworks.com/help/matlab/ref/matlab.ui.container.menu-properties.html> m = uimenu; m.Te...

plus de 8 ans il y a | 0

Réponse apportée
Undefined function or variable
You still haven't answered _how_ you set the path. Use addpath, addpath('C:\Users\MyName\Documents\MATLAB') read more her...

plus de 8 ans il y a | 0

Réponse apportée
How to indexing directly multiple row?
use linear indices, read this: <https://www.mathworks.com/help/matlab/ref/sub2ind.html> With your example, colInd = r...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How to display the output using GUI? (not guide)
Have a textbox in your GUI and set this textbox's value in your pushbutton callback function pushbutton_callback(...) ...

plus de 8 ans il y a | 0

Réponse apportée
Global variables (not sure if it's the case or not)
One idea is to use structs. Put all your variables under this struct and you'd need to pass only this struct. For example, ...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Dimensions of matrices being concatenated are not consistent.
The error comes from your very first line when you're trying to create a char array called letter. Look at this example, >>...

plus de 8 ans il y a | 3

| A accepté

Réponse apportée
Adding legend to plots created by for loops
There are various ways. You can simply add the legend after you plot everything like, legend({'essential','less essential','...

plus de 8 ans il y a | 0

Réponse apportée
Load variables with same name with uigetfile and give them a new name automatically
Don't do that! why? read this: <https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How can i add 0 or 1 to an vector?
use |diff|, <https://www.mathworks.com/help/matlab/ref/diff.html> new_vector = [0 diff(Pos)>0] the answer is ...

plus de 8 ans il y a | 1

| A accepté

Réponse apportée
Getting error Data variables must be numeric or logical when doing grpstats
use |varfun|, <https://www.mathworks.com/help/matlab/ref/varfun.html> t2_mean = varfun(@mean,t2(:,[1 2 3 6]),'GroupingVar...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Percentage in tablerows with subgrouping
Your last column is the sum of correct answer for every case and you can calculate the percentage of correct answer with that us...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
how can i find max value in the 2d plot graph with x axis location ?
Looks like you simply want to extract the index of the max value from powerDensity vector, [maxPD,indx] = max(powerDensity);...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How do I tell Matlab to Label the point where my subplots are equal?
Why are you using a cell array? It looks like you're better off with a numeric array and then you also wouldn't need a loop in t...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Can anyone help me understand what it is asking? Plotting wise.
Without knowing the details about the variables |y1,y2| and |N|, all I can say is you are asked to create a function like, f...

plus de 8 ans il y a | 0

Réponse apportée
How to find a row that have maximum mean value in 2D array?
You'd need [maxVal, maxInd] = max(mean(S,2)) mean with parameter 2 calculates mean on the second dimension and then you ...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Subscript indices must either be real positive integers or logicals.
when you write, y(n+1)=x(n)+0.005.*(((y).^2)+(7*y)+2)/(3*x((y).^2)+((1-x)*(3*((y)^2)+7))); ...

plus de 8 ans il y a | 0

Réponse apportée
Conditional in values of a matrix
indx = A(:,2)<0; B = indx.*A(:,2) + ~indx.*(A(:,2)-A(:,3).*abs(A(:,2)))

plus de 8 ans il y a | 2

| A accepté

Réponse apportée
Find positive elements in a 3D matrix
*EDITED* If you want to copy the elements only if all the elements in a row in that *page* is positive. In that case, you can...

plus de 8 ans il y a | 0

Réponse apportée
Combine Strrep in one Line.
use replace with cell arrays, <https://www.mathworks.com/help/matlab/ref/replace.html> a = 'abcxyz' old = {'x';'z'}; ...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How can I call all element from cell class ?
cat(1,A{:})

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Array of x and y values. Find value of y when x=0, how?
You might want to use interp1, read: <https://de.mathworks.com/help/matlab/ref/interp1.html> Hint: For your case, 0 lies o...

plus de 8 ans il y a | 0

Réponse apportée
Insert an element once in a listbox
Check if your string already existing in your listbox and make output false in that case? Something like, if (Output...

plus de 8 ans il y a | 0

Réponse apportée
How can I preallocate me code?
Use indexing. Pre-allocating won't make a big difference if you have a for loop there. roll = randi([1 6], 1, 10000); in...

plus de 8 ans il y a | 0

Réponse apportée
Reading strings from text file to a MATLAB cell array
Try textscan, fid = fopen('file.txt'); data = textscan(fid,'%s%s%s'); fclose(fid);

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Area for Values in Column
if you want to delete the rows that are not within your range, it should be, DI = A(:,10)>135 & A(:,10)<315; A(~DI,:) = []...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How to save into a particular variable space in .mat file?
The same command which I just gave you for your other question. That's why you should read the link! A = rand(100,1); sa...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How to add a result on a plot.
use num2str to convert the result to string and use it inside text command, text(x_pos, y_pos, ['the root of the function is...

plus de 8 ans il y a | 0

| A accepté

Charger plus