Respondida
Index in position 2 must be positive or logical value error?
You'd think that 100*round(x,2) would be an exact integer value and in fact would be the same as round(100*x), but that's not ne...

alrededor de 4 años hace | 1

| aceptada

Respondida
Plot strings on y axis
plot((1:15)/15,[7:-1:0 1:7]) % some plot set(gca(),'YTick',0:7,'YTickLabels',dec2bin(0:7,3)) % set the yticks and labels

alrededor de 4 años hace | 0

Respondida
Remove array elements if a certain condition is met with a for loop
Here's one way, using a for loop: JDF = [CorrCKASRoll1,CorrCKASPitch1,CorrJoystickRoll1,CorrJoystickPitch1]; CKASR = JDF(:,1...

alrededor de 4 años hace | 1

| aceptada

Respondida
Minimalizing a function of two variables
First thing. This: fminsearch(FullScore,[15 0.5]) calls the function FullScore with no inputs; that's why you get that error. ...

alrededor de 4 años hace | 0

| aceptada

Respondida
Prevent double-clicks in appDesigner
Maybe you can try setting a flag, i.e., a variable of class logical, that indicates whether the data acquisition routine is runn...

alrededor de 4 años hace | 0

| aceptada

Respondida
Binary enabler for matrix
Inputs = ["AA" "BB" "CC" "DD" "EE" "FF"]; to_enable = logical([1 1 1 0 1 1]); Inputs(to_enable)

alrededor de 4 años hace | 0

| aceptada

Respondida
How to extract data from matrix A(19,1900) which corresponds to data of Matrix B (1x1900) ?
Pw = randn(19,1900) BSd = randi(19,1,1900) [m,n] = size(Pw); P = Pw(sub2ind([m n],BSd,1:n))

alrededor de 4 años hace | 1

| aceptada

Respondida
Rearrange the rows as column variables
If I understand correctly, you only need the times corresponding to sensor #0, and the other times can be discarded/ignored. If ...

alrededor de 4 años hace | 0

| aceptada

Respondida
Assigning the Nth element of Cell Array to another Array
If array is a 1000-by-3 cell array, then you already know how to do it (here I'll use a 10-by-3 cell array): % creating a 10-by...

alrededor de 4 años hace | 0

| aceptada

Respondida
What is the Colormap for plotting weather radar velocity product with interval?
You can take the colors directly from the colorbar in the image, and use them as your colormap: data = imread('velocity plot.jp...

alrededor de 4 años hace | 0

Respondida
Writing a function to count the number of times a word pops up in a random word generation.
Consider the difference between the following two pieces of code. First, set up the variables for both: number_of_words = 5; ...

alrededor de 4 años hace | 0

Respondida
How to use 'median filter and gaussian filter' in matlab ?
Try imgaussfilt instead of imgausstfilt (note the extra t) denoise1 = imgaussfilt(randn(100),2); % works denoise1 = imgausst...

alrededor de 4 años hace | 0

| aceptada

Respondida
How to find variable location?
The way I would go about this is to open "Find Files" https://www.mathworks.com/help/matlab/matlab_env/finding-files-and-folder...

alrededor de 4 años hace | 0

Respondida
cannot plot distance with respect to Theta2.
L6 and thta2 are scalars, so you're plotting one point at a time. A line with one point doesn't show up unless it has a marker, ...

alrededor de 4 años hace | 0

Respondida
Scatter plot legend for only two of the three plotted categories
scatter creates a single scatter object, so you won't be able to make multiple legend entries from it, but you can create additi...

alrededor de 4 años hace | 1

| aceptada

Respondida
Issue with for loop, finding file in directory
You mention the file "data_1" in a comment here: https://www.mathworks.com/matlabcentral/answers/1733090-running-4-matlab-scrip...

alrededor de 4 años hace | 0

Respondida
extractBefore with matches string
In this case, you can include spaces around '333' to match the pure one: a = {'32563 33308 10314 20227 30113 40117 52008 81531 ...

alrededor de 4 años hace | 0

| aceptada

Respondida
Plotting filled contours on top of worldmap
I'm not able to see the problem as described, using the data posted. However, check the order of the arguments you're using in ...

alrededor de 4 años hace | 0

| aceptada

Respondida
Colour coding based on the number of data points in each grid?
You can use nnz to give you the number of points in each bin. Since you already have a logical index idx that tells you whether ...

alrededor de 4 años hace | 1

| aceptada

Respondida
How to search and find nearest data in the given array
load('array.mat') n = 70; SP = 998.45; % find the rows where column 2 of array is SP matching_rows = find(array(:,2) == ...

alrededor de 4 años hace | 0

| aceptada

Respondida
Put the leading number corresponding to the number in the column
rowcell={'10302','20245','30108','40112','52013','85911',[],[];'10268',[],'30095','40099','52014','69944','81502',[];'10308','20...

alrededor de 4 años hace | 1

| aceptada

Respondida
Add vector items one-by-one to array
v = [10 20 30]; a = [11 12 13 14]; out = reshape(a.'+[0 v],1,[])

alrededor de 4 años hace | 1

| aceptada

Respondida
How to vectorize the following operations?
Yes, this can be vectorized. d = 4; n = 5; A = rand(d,d,n); x = rand(d,n); y = rand(d,n); % for-loop b calculation b_fo...

alrededor de 4 años hace | 0

Respondida
overlay two surface or mesh plots
topography = imread('topography.jpg'); curvature = imread('curvature.jpg'); % attempting to crop axes and labels from images...

alrededor de 4 años hace | 0

Respondida
Time Vector in X axis Plotting
aa = {rand(482,5) , rand(493,5)}; t = linspace(0, 20,975 ); % Generating Time Vector Series n_aa = cellfun(@(x)size(x,1),aa)...

alrededor de 4 años hace | 0

| aceptada

Respondida
the piecewise function runs out a weird figure
x=0:0.1:10; y=myfun(x); plot(x,y) function f = myfun(x) idx = x < 1; f = zeros(size(x)); f(idx) = x(idx).^2; f(~idx) = x(...

alrededor de 4 años hace | 0

Respondida
Concatenate multiple cell into a single cell
ncell1={'12','21','44','02','35'}; % 1x5 cell ncell2={'03','21','45','45','11'}; % 1x5 cell ncell3={...

alrededor de 4 años hace | 0

| aceptada

Respondida
My variable names for a table aren't the same length even though they are both 20 long and won't change
I don't know what class app.UITable3.Data is, but in another question (here), you say that calling writematrix(app.UITable.Data)...

alrededor de 4 años hace | 0

| aceptada

Respondida
I want to color code US states by specific metrics. What is the easiest way to do this?
Here's how you can make a map colored by log10 of Population Density (2000), which is the variable color_value below. You can ch...

alrededor de 4 años hace | 1

| aceptada

Respondida
how to compare two values that are repeated in two vectors?
A = [10 56 34 11 34 ]; B = [10 56 34 11 ]; result = [B.' sum(A==B.',2)<=1] Breaking that expression down: A==B.' % compare...

alrededor de 4 años hace | 0

| aceptada

Cargar más