How to plot quiver with same scale on x and y axis?
Have you tried axis equal? % random quiver plot d = datenum(now()); x = d:1e-6:d+1e-4; y = randn(1,101); u = randn(1,101)...

5日 前 | 0

I need help setting a pushbutton in a GUI
% (you can specify all those properties at the same time as you create the % uicontrol) my_third_button = uicontrol( ... ...

5日 前 | 0

| 採用済み

What indices of the original sequence are retained in the output of the decimate function?
From item #3 in the Algorithms section of the documentation for decimate: "In the resampled sequence (y), y(end) matches x(end)...

5日 前 | 0

| 採用済み

How to show function's result from command window to a "text area or edit field" in app designer ??
function get_powerButtonPushed(app, event) app.PowerTextArea.Value = app.obj.get_power(1); end Note that this is the call...

5日 前 | 0

| 採用済み

Read text file, identify variables and rewrite some of the variables
% read the file into a char vector: fid = fopen('Initial.txt'); data = fread(fid,'*char').'; fclose(fid); disp(data); % spl...

5日 前 | 1

| 採用済み

Search for the Y coordinate knowing the X coordinate
coord_x = A(:,1); coord_y = A(:,2); [X,idx] = max(coord_x); Y = coord_y(idx);

5日 前 | 1

| 採用済み

Padding a cell array?
Maybe something like this: C = {1 2 3 4}; C_new = cell(1,2*numel(C)); C_new(1:2:end) = C

6日 前 | 0

| 採用済み

Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-2.
This line, which is a few lines above the line with the error: vr(ii,jj) = lamb/(2.*pi*r); makes vr a 1-by-2 vector when it is...

6日 前 | 0

Finding min and max values in a structure
"a 1x1 structure with multiple fields, each field consisting of a cell of numbers" yourStruct.a={1,2}; yourStruct.b={3 4; ...

6日 前 | 0

How to index a matrix to make it from a vector, taking some elements from the vector and put them in a new row?
Here's one way to do it: pilots4356 = 43:56; %vector N = numel(pilots4356)-2; matrix4356 = zeros(N,N+2); %matrix size % ...

6日 前 | 0

| 採用済み

Sorting a matrix column to match another column
t = table( ... ["a";"c";"e";"g"],["b";"d";"f";"h"],[44; 16; 03; 63]) d = [63; 16; 44; 3]; [~,idx] = ismember(d,t{:,3});...

6日 前 | 0

How i can convert a text into binary and then split the binary form, finally convert each partition into ASCII code?
You can replace your for loop with this, which will be faster because it calls dec2bin one time on the entire text instead of on...

6日 前 | 0

| 採用済み

how can i convert table of string to a single row vector
Something like this? % making a table like yours: transcript = table(["the"; "discreet"; "forier"; "transform"; "of"],[0.99085...

6日 前 | 0

I need help randomizing a triangle
It is not enough to generate a new random point_A, point_B, and point_C on each iteration. You need to make those points take ef...

6日 前 | 0

| 採用済み

How can I create a bar plot like the following figure in Matlab? Any help? Thank you.
See bar: <https://www.mathworks.com/help/matlab/ref/bar.html>

7日 前 | 0

Convert equation into code
c1 = 2; c2 = 4; c3 = 5; J = 10:10:50; O = zeros(size(J)); O(1) = J(1); for n = 1:numel(O)-1 O(n+1...

7日 前 | 0

Why am I getting this error? "Array indices must be positive integers or logical values".
On that line, everything inside the outermost parentheses on the right-hand side is an index into P0: P_twitch_short(i) = P0(0....

8日 前 | 1

| 採用済み

How can I enter a matrix into GUI?
You can use a multi-line edit box, see: https://www.mathworks.com/matlabcentral/answers/94590-how-do-i-enter-and-evaluate-multip...

8日 前 | 0

Insufficient number of outputs from right hand side of equal sign to satisfy assignment.
CEST = [2022,10, 11, 2, 0, 0]; UTC = CEST-[0, 0, 0, 2, 0, 0]; This is what you intend to do: yyyy = UTC(1); mm = UTC(2); dd...

8日 前 | 0

| 採用済み

how to get a new array with some values ​​from an old array
B = (A >= 20) % same as B = A >= 20, i.e., without parentheses makes B a matrix of logicals, the same size as A; the elements o...

8日 前 | 0

| 採用済み

Plotting multiple current loops for magnetic field
The problem is that Rx, Ry, and Rz are overwritten in the outer for loop: % before the loop, calculate Rx, Ry, Rz: Rz = r.*cos...

8日 前 | 0

| 採用済み

Extracting numbers including 0 at the start of the number
x = '02290234567'; x = x - '0'

10日 前 | 0

How can I select a part of a matrix ?
B = [1 0.3 2 0.6 3 0.5 4 0.7 5 0.2 6 0.5 7 0.4 8 0.5]; idx ...

11日 前 | 1

| 採用済み

How to store data without deleting previous one
mask is a variable that only exists in the workspace of the DRAW function. In other words, each time DRAW is executed, a new mas...

11日 前 | 0

| 採用済み

The size of X must match the size of Z or the number of columns of Z.
The error happens because T is a 102-by-102 matrix but X and Y only have 101 elements: % % geometry of domain Nx = 102; Ny = ...

11日 前 | 0

How i can convert binary elements of cell into decimal elements and store the results in array?
MB = { '0101' '0011' '0111' '0100' '0110' '0101' '0110' '0111' '0110' '1111'}; D = bin2dec(MB)

11日 前 | 1

| 採用済み

Reshaping a cell array
C = {{[1 2 3]} {[4 5 6 7]} {[8 9]}} C = [C{:}]

11日 前 | 0

| 採用済み

How can I find numeric values (stored as strings) in table of strings and convert them to double?
"Is there a possibility to find numeric values that are stored as string/char within a cell array and to convert only them?" Ye...

11日 前 | 0

| 採用済み

How to plot a smooth curve while data point order is messed up
Some random data: data = randn(10,2) Sort on the first column: [~,idx] = sort(data(:,1)); data = data(idx,:) Then plot with...

11日 前 | 1

| 採用済み

Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-2
The error message will tell you which line the error occurred on, but I think it's this one: meansData_1(i,:)=mean(storeall...

11日 前 | 1

| 採用済み