Réponse apportée
Using 'OR' operator with 'case' statement
This would be the proper way for using or: switch value case {1,2,3} % execute this case {4,5,6} % execute this end

plus de 7 ans il y a | 11

| A accepté

Réponse apportée
Returning indicies from a matrix and returning the indicies not included in the first answer
allVisibleVolcanos = [3 7 8 9 50 ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How do i make the title, axes labels, and legends larger in existing figures?
each one of those graphic objects (title,axes,legend) has their own properties you can edit. for example, if you havent assigne...

plus de 7 ans il y a | 0

Réponse apportée
Sum variables from three in three, after summing compute an equation and organize all data into a new column?
https://www.mathworks.com/help/matlab/ref/sum.html

plus de 7 ans il y a | 0

Réponse apportée
How do I make function which gets as input arguments matrix of chars work?
Use curly brackets. example: case {'GUU', 'GUC', 'GUA', 'GUG'} aminoacids{m} = 'Val'; I also dont think you need ...

plus de 7 ans il y a | 1

Réponse apportée
using strcmp on nested cell array (cell array within a cell array)
if a is your cell array: myText ='Text1'; idx = find(cellfun(@ischar,a)) %returns those indices where cell is a chr array idx...

plus de 7 ans il y a | 0

Réponse apportée
Multiple Plots on Single Figures in Loop
figure() will automatically create a new figure. figure (1) %Plot vehicle speed trace figure('Name', 'Vehicle Speed','Number...

plus de 7 ans il y a | 0

Réponse apportée
How can I create a structure?
Remove the quotation marks. You're storing the string 'Columns' and 'Rows' isntead of the actual numeric variable. You also don...

plus de 7 ans il y a | 0

Réponse apportée
Is there a faster alternative to plot in MATLAB?
im not too sure how the rest of your code looks like, but maybe you can clean it up by just assigning handles to your axes (each...

plus de 7 ans il y a | 0

Réponse apportée
write a script that creates identity matrices of any size without using the function eye
n = zeros(5); %square matrix for i= 1:size(n,1) n(i,i) = 1; end

plus de 7 ans il y a | 0

Réponse apportée
implement a script that calculates 1^3+2^3+...+10^3+11^3. a) use a for or a while loop. b)use vectors
x = 1:11; %for loop sum=0; for i = 1:numel(x) sum = sum + x(i)^3; end %vector method vec = sum(x.^3);

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
switch statements and trig function
you can just run the input once, and evaluate the input as a whole. word = input('enter letter followed by number','s'); if n...

plus de 7 ans il y a | 0

Réponse apportée
using while loops and random number generators
you needed one more line: var = 'y'; while (var=='y') u=input('how many?', 's'); u = str2num(u); % u was a char, no...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Dropping NaN observations from Matrix
if you had a matrix A and wanted to search for NaNs in each row nanRows =[]; for i = 1:size(A,1) if any(isnan(A(i,:))) % ...

plus de 7 ans il y a | 0

Réponse apportée
How can I animate plotted data over time?
each update of the plot can be shown with drawnow https://www.mathworks.com/help/matlab/ref/drawnow.html

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Graph plot always appears as a straight line
if r is a constant, you will get a straight line. if r varies, then you will get a curve. also, you may want to add a period be...

plus de 7 ans il y a | 0

Réponse apportée
Multiplications inside a cell array
use cell brackets to access contents of the cell array. so if c is your 4x12 cell array, then c{2,1} would retun the array insi...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
How can i detect max value and his index ?
[max_val idx] = max(a) max_val would be the max value in your array a, idx would be the index. i have no idea what 'a(1)=...

plus de 7 ans il y a | 0

Réponse apportée
GUI - Real time Spectrogram
I am not too sure what you have tried so far, but reading this documentation might help with both your planning of how you want ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Sort elements of an array with a given a priority, keeping track of indexes (includes repeated elements)
There might be something more elegant than my for-loop, but this should work. Let me know! vR = [1.5 2 1.25 3 3.5 5 8 2.359 3 ]...

plus de 7 ans il y a | 0

Réponse apportée
Using loop to plot numbers on a single plot while simultaneously giving each number/data point a different marker symbol.
You need to do, for i = 1:12 plot(z(i),'Marker',markers{i}) hold on end

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How to create a vector?
v = []; for k=2:length(val)-1; if(val(k)>val(k-1)&val(k)>val(k+1)&val(k)>1) k disp('Prominant peak found...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Find average values in a table
a = randi(10,5,7); % let a be your matrix closest_all =zeros(1,7); for i = 1:size(a,2) %first row values, num = a(1,i); ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Unable to perform assignment because the left and right sides have a different number of elements.
you are setting an element, a(t) to be equal to your entire matrix a. Not sure what you are trying to do, please reformat you...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How to go from if..end to switch..end?
Not sure what you are doing with your loop, but according to what you have, switching from if/else to switch/case: soma=0 fo...

plus de 7 ans il y a | 1

Réponse apportée
Identifying a file based on character
example use of the contains() function: my_string = '001BL100XP0102.HWR' if contains(my_string,'P01') targ_coord = [...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
I have to create a matrix using only zeros, ones and eye
your command A = [B;C] concatenated them vertically. Try: C = eye(5) C(1,:) = 1; % turns every element along the first row to...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How to find the difference of the maximum points between datasets
if y1 is vector consisting of the y-values for your sinewave, max(y1) will return the max value. min(y1) will give you its mi...

plus de 7 ans il y a | 0

Réponse apportée
Creating a matrix which has particular order of element ?
Can you be more clear in what you are trying to do? Is this pattern supposed to go on? Or is this matrix A that you have provide...

plus de 7 ans il y a | 0

Réponse apportée
Data point in plot connecting randomly to each other
I would sort the x values and sort the y values based on how the x values were sorted. You can do this with [sorted_array sor...

plus de 7 ans il y a | 1

| A accepté

Charger plus