Risposto
write an array of 8 bit binary to text file?
You don't need fopen, fprintf, or fclose. A simple script like this will do the trick: binX = ['00101111'; '00101111'; '0111001...

oltre 4 anni fa | 0

| accettato

Risposto
How do I get each array produced by a for loop iteration to be added as a different column in matrix?
This should work: k = 1; for olYears = 2000:2020 p = find(olYr == olYears); p1 = olTemps(p) %this produces an array ...

oltre 4 anni fa | 0

| accettato

Risposto
How to subtract previous array element from the current one ?
If you want to subtract previous Easting value from the current one see below. The value you want is EastingDiff. Easti...

oltre 4 anni fa | 0

| accettato

Risposto
How to take average for each bin and then plot it?
Here's what I put together. Looks like most of the 19124 data points have NaN for either temperature or data. There are 6901 p...

oltre 4 anni fa | 0

Risposto
How can I stop my program if the user enters 0 for all variables?
There are a few ways to set this up. Here's one... while true clc; a = input("a = "); b = input("b = "); ...

oltre 4 anni fa | 0

| accettato

Risposto
Tabluate data using common terms in varaible names
If I understand your question correctly, you want to extract the row and column names from the variable names. If so... ab_MLD...

oltre 4 anni fa | 0

| accettato

Risposto
Could anyone help me how to extract different specific number of rows in a matrix.
B = A(sort([1:5:100 2:5:100]))

oltre 4 anni fa | 0

Risposto
Regression Model Graph(plot), Deflection Problem(sharp point or cusp)
You are getting the sharp bend because you are calculating YFIT using the x sample points (which are sparce at the inflexion poi...

oltre 4 anni fa | 0

Risposto
The code does not see else condition
You've got an error in how you setup the if-expressions. For example, you need to change the first if-expression from 320 < wa...

oltre 4 anni fa | 1

| accettato

Risposto
How can I Draw a Line on a 3D plot?
Here's an example using line. I used your code, but re-assigned ax.UIAxes2, Bat, and value so the code would execute on my mach...

oltre 4 anni fa | 0

| accettato

Risposto
Excel Variables and Data Analysis
I'm attaching some fake data I put together that match the description of your data. Given this, here's some code to answer you...

oltre 4 anni fa | 0

Risposto
Find the index of specific values in my matrix
No need for loops. Just use the ind2sub function: A = [0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0] [x, y] = ind2sub(...

oltre 4 anni fa | 1

| accettato

Risposto
remove empty rows of a cell
reshape(K(~cellfun('isempty',K)), [], size(K,2))

oltre 4 anni fa | 0

| accettato

Risposto
How to add text on the figure without unknown x and y coordinates ?
To print 'hello' in the center of the figure... (adjust accordingly) ax = gca; x = ax.XLim(1) + (ax.XLim(2) - ax.XLim(1)) / 2;...

oltre 4 anni fa | 0

Risposto
What is the problem in my for loops?
You don't need nested loops: m = 12; n = 2; p = 100; fprintf('\nColumn 1\t\tColumn 2\n'); for i = 0:n:m a = 2....

oltre 4 anni fa | 0

Risposto
How to make graphic get the same color as the colorbar?
I think this achieves what you are after. Use mesh, instead of plot3, and the mesh colors will be linked to the colorbar: % yo...

oltre 4 anni fa | 1

| accettato

Risposto
Measuring distance in 2D plot
Just adding this to the end of your code achieves what you are after (I think). The x-length of the line easy enough to calcula...

oltre 4 anni fa | 0

| accettato

Risposto
Variables in matrix not updating from for loop
I think this is what you are looking for. It updates k in the z matrix in each iteration of the loop. The max values accumulat...

oltre 4 anni fa | 1

| accettato

Risposto
How to choose the middle of a random cell in a 2D grid
This solution is simpler. It creates the grid using lines instead of a mesh. % x axis smin = 0; L = 4; ns = 25; s = lin...

oltre 4 anni fa | 0

Risposto
Read elements on one side of matrix diagonal into a 1D array
There might be a tighter solution, but I think this achieves what you are after: a = magic(4) b = a'; c = logical(triu(ones(4...

oltre 4 anni fa | 1

| accettato

Risposto
How do you write a nested if statement that checks if the user has entered certain numbers?
This is an example of input validation. Here's one method that achieves what you are after. The prompt is repeated until the u...

oltre 4 anni fa | 1

| accettato

Risposto
Creating index and replacing values
Below is a loop solution. There might be a way to vectorize this -- not sure. A = [0 0 1 0 1 0 0]; B = [ "030121", "030221", ...

oltre 4 anni fa | 0

Risposto
How to find multiple table column numbers by column names?
col_ind_rmt = find(string(G_Value.Properties.VariableNames) == "rk_mill_tonnage" | ... string(G_Value.Properties.VariableNa...

oltre 4 anni fa | 0

| accettato

Risposto
How to choose the middle of a random cell in a 2D grid
OK, thanks for the clarification. I think this achieves what you are after. The added code randomly chooses vertices (points) ...

oltre 4 anni fa | 0

| accettato

Risposto
Customed distance function Haversine
You need to re-work your haversine function, as per the requirements for distance functions used with pdist2. A custom distance...

oltre 4 anni fa | 0

| accettato

Risposto
Verifying an Vector composition
There is probably an easier approach, but I think this works. The result of this expression is 1 if a1<a2<a3<a4<a5, or 0 otherw...

oltre 4 anni fa | 1

Risposto
how can I sweep a triangle area using two loops
No need for loops. The tests are built in to the inpolygon function when you provide matrices as input. Assuming you want to f...

oltre 4 anni fa | 0

Risposto
HOW TO FILTER AN HOUR DATA FROM ARRAY OF DAILY,MONTHLY AND YEAR DATA
T = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/658625/SAMPLE%20DATA.xlsx'); % combine DATE and...

oltre 4 anni fa | 0

Risposto
How to duplicate cell array by rows?
n = handles.times; % your integer value newSequence = repmat(sequence, 1, n);

oltre 4 anni fa | 0

| accettato

Risposto
integral of a matrix
You note: I want to take the integral of an exponetial of a matrix But, exp(-M.*t)*Dmat; is a vector, not a matrix. Tr...

oltre 4 anni fa | 0

Carica altro