Respondida
display all the matrices present in the cell in one figure
figure hold on for kkk = 1:3 plot3(output{kkk,1}(:,1), output{kkk,1}(:,2), output{kkk,1}(:,3),'k.','Markersize',15); end...

más de 3 años hace | 0

| aceptada

Respondida
Enter the elements of matrix in a specified location of a text file
% "data" would contain your data, but for % demonstration, I use 1:1000 in order: data = reshape(1:1000,[10 10 10]); % 10x10x...

más de 3 años hace | 1

| aceptada

Respondida
What is the script to plot the following function in MatLab? (I don't have syms function, those are ln(r) in function)
% One way f = @(r)0.25*r.^2 - 1.821*log(r) + 0.249 + 0.455*log(r) - 0.5; fplot(f); % Another way r = 0.05:0.001:5; y = 0.25...

más de 3 años hace | 0

Respondida
Can I set variable TSK to NaN in WRF output file?
Code adapted from your other question. filename=('wrfout_d03_2018-07-03_12:00:00'); temp=ncread(filename, 'TSK'); temp(temp...

más de 3 años hace | 0

| aceptada

Respondida
while loop or loop
Something like this: x = 2500.5; % initialize x to a value that will cause the loop to run while x > 2500 && x < 2501 % c...

más de 3 años hace | 0

Respondida
How to take an exponential to a non-integer value?
It may be that the error is about trying to index a variable called exp with invalid values. Do you have a variable called exp? ...

más de 3 años hace | 1

| aceptada

Respondida
Importing Excel Database Into MATLAB
The problem is that you're specifying the Range to start on row 2. Remove the Range arguments: test = readtable('./dataset2.xls...

más de 3 años hace | 0

| aceptada

Respondida
How do I add the filename of where the data came from into a new column in a for loop
myFolder = pwd();%'C:\users\examples\documents'; if ~isdir(myFolder) errorMessage = sprintf('Error: The following folder do...

más de 3 años hace | 0

| aceptada

Respondida
Find the value which is repeated in each row of a matrix (without loop for)
Assuming that there's exactly one repeat (i.e., one number appears two times) in each row, which the for-loop solution also assu...

más de 3 años hace | 1

| aceptada

Respondida
I am trying to plot my data and there are 90 data points not sure what I am doing wrong all data is in the code
You are creating a scatter plot with 20 random points: scatter((1:20),rand(1,20)); so maybe that's the 20 you're referring to....

más de 3 años hace | 0

Respondida
Write table in matlab
A = [3 4 5 6]; B = [4 5 6 7]; data = array2table([A B]); save('save.mat','data')

más de 3 años hace | 0

Respondida
How can I quantify the number of cells between specific values?
A = [0 0 1 0 0 0 0 1 1 0 1 0 1 0 0 0 1 1 0 0 ...

más de 3 años hace | 1

| aceptada

Respondida
Compose two vectors from one vector with step
N = 64; S = 1:N; M = 4; S_new = reshape(permute(reshape(S,M,2,[]),[1 3 2]),N/2,[]).' Now S_new(1,:) is your S_1 and S_new(...

más de 3 años hace | 0

| aceptada

Respondida
Stacking 2D matrix to 3D using time as a third variable
nx = numel(x); data = struct( ... 'time',zeros(1,nx), ... 'sst',zeros(nx,1440,720); for ii = 1:nx d...

más de 3 años hace | 0

| aceptada

Respondida
Trying to graph a certain number of periods of a sine function
A= 2; % amplitude = 2 f = 10; % frequency = 10 Hz (a.k.a. 10 cycles per second) N = 4; % number of periods = 4 (a.k.a. 4 cy...

más de 3 años hace | 0

Respondida
How to remove empty space after legend?
You can adjust the axes height as below (I'm using a red figure so you can see the space beneath the axes here in the online env...

más de 3 años hace | 1

| aceptada

Respondida
loop in two matrices for extracting values and plot lines
J = [2.5 27 56]; WZ = [12.2 23.2 33]; M1 = 22; I1 = 2600; for ii = 1:numel(WZ) line([I1;WZ(ii)+2500],[M1;J(ii)]); ...

más de 3 años hace | 1

| aceptada

Respondida
Use a for loop to generate function arguments
n = 50; data = cell(1,n); % cell array to contain the output from my_function for all iterations input_args = {}; % cell arra...

más de 3 años hace | 1

| aceptada

Respondida
Finding a variable in a large table
% a table with station names and other info: t = table(["Picadilly Circus"; "St. John's Wood"; "Cockfosters"],rand(3,1),rand(3,...

más de 3 años hace | 0

| aceptada

Respondida
How can I get rid of the ---data1 after using legend code, I just want to keep the name of the planet?
In your call to legend, you can specify which graphics objects should be included in the legend, as shown in this question and a...

más de 3 años hace | 1

Respondida
Offsetting the text coordinates on a plot
Making up some data: t1 = 5.9848; t2 = 7.623; t3 = 9.234; t4 = 10.982; t5 = 13.223; t6 = 14.765; t7 = 16.023; t8 = 18.12...

más de 3 años hace | 0

Respondida
I need help rearranging values in a 2D Matrix to create contour plots
Try this: clc;clear; Uall=[]; Vall=[]; for i=0:798 temp_L=importdata(['Final Project Adaptive PIV.76m7uaui.', num2str(i...

más de 3 años hace | 0

Respondida
Ignoring the line continuation (...) when reading a text file
You can rename the txt file to an m-file and run it like any other MATLAB script. The name of the m-file cannot be test.m in thi...

más de 3 años hace | 0

| aceptada

Respondida
Finding a value of one vector based on the nonzero values of another vector
A = A(B == 1)

más de 3 años hace | 0

Respondida
Warning: Ignoring extra legend entries. How do I fix this?
When n == 1, bar() gives you a single series (update has one row): figure bar([2 3],'grouped') % notice: no orange bars as op...

más de 3 años hace | 1

| aceptada

Respondida
colorbar scale is not correct when using isosurface and patch plots
Is this how it should be? unzip('ne231.zip') Nx = 128; Ny = 128; Nz = 128; Lx =128; Ly = 128; Lz = 128; xi = ...

más de 3 años hace | 0

Respondida
Is my code for this assignment correct?
You can construct a cell array more directly than that (which is not to say your approach is "incorrect"): S = {'Argentina' 'Bo...

más de 3 años hace | 0

| aceptada

Respondida
using trapz in a for loop
When you call trapz with two arguments and the second argument is a scalar (like what happens in your loop when i == 1), then tr...

más de 3 años hace | 0

Respondida
Loop For extract maximum rows of matrix based on vectors
data = [ 1 3 4 1 5 4 1 6 4 1 2 4 1 1 4 2 4 4 2 4 4 2 4 4 2 4 4 2 5 4 1 1 4 1 1 4 1 2 4 1 3 4 1 5 4 2 5 4 2 5 4 ...

más de 3 años hace | 0

| aceptada

Cargar más