Respondida
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

más de 7 años hace | 11

| aceptada

Respondida
Returning indicies from a matrix and returning the indicies not included in the first answer
allVisibleVolcanos = [3 7 8 9 50 ...

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 0

Respondida
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

más de 7 años hace | 0

Respondida
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 ...

más de 7 años hace | 1

Respondida
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...

más de 7 años hace | 0

Respondida
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...

más de 7 años hace | 0

Respondida
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...

más de 7 años hace | 0

Respondida
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...

más de 7 años hace | 0

Respondida
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

más de 7 años hace | 0

Respondida
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);

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 0

Respondida
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...

más de 7 años hace | 0

| aceptada

Respondida
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,:))) % ...

más de 7 años hace | 0

Respondida
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

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 0

Respondida
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...

más de 7 años hace | 1

| aceptada

Respondida
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)=...

más de 7 años hace | 0

Respondida
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 ...

más de 7 años hace | 0

| aceptada

Respondida
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 ]...

más de 7 años hace | 0

Respondida
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

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 0

| aceptada

Respondida
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); ...

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 1

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

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 0

Respondida
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...

más de 7 años hace | 0

Respondida
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...

más de 7 años hace | 1

| aceptada

Cargar más