Beantwortet
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

etwa 7 Jahre vor | 11

| akzeptiert

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

etwa 7 Jahre vor | 0

| akzeptiert

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

etwa 7 Jahre vor | 0

Beantwortet
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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 1

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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 0

Beantwortet
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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 0

| akzeptiert

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

mehr als 7 Jahre vor | 0

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

mehr als 7 Jahre vor | 0

| akzeptiert

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

mehr als 7 Jahre vor | 0

Beantwortet
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

mehr als 7 Jahre vor | 0

| akzeptiert

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

mehr als 7 Jahre vor | 0

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

mehr als 7 Jahre vor | 1

| akzeptiert

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

mehr als 7 Jahre vor | 0

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

mehr als 7 Jahre vor | 0

| akzeptiert

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

mehr als 7 Jahre vor | 0

Beantwortet
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

mehr als 7 Jahre vor | 0

| akzeptiert

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

mehr als 7 Jahre vor | 0

| akzeptiert

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

mehr als 7 Jahre vor | 0

| akzeptiert

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

mehr als 7 Jahre vor | 0

| akzeptiert

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

mehr als 7 Jahre vor | 1

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

mehr als 7 Jahre vor | 0

| akzeptiert

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

mehr als 7 Jahre vor | 0

| akzeptiert

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

mehr als 7 Jahre vor | 0

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

mehr als 7 Jahre vor | 0

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

mehr als 7 Jahre vor | 1

| akzeptiert

Mehr laden