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

3 years ago | 0

| accepted

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

3 years ago | 1

| accepted

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

3 years ago | 0

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

3 years ago | 0

| accepted

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

3 years ago | 0

Answered
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? ...

3 years ago | 1

| accepted

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

3 years ago | 0

| accepted

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

3 years ago | 0

| accepted

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

3 years ago | 1

| accepted

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

3 years ago | 0

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

3 years ago | 0

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

3 years ago | 1

| accepted

Answered
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(...

3 years ago | 0

| accepted

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

3 years ago | 0

| accepted

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

3 years ago | 0

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

3 years ago | 1

| accepted

Answered
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)]); ...

3 years ago | 1

| accepted

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

3 years ago | 1

| accepted

Answered
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,...

3 years ago | 0

| accepted

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

3 years ago | 1

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

3 years ago | 0

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

3 years ago | 0

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

3 years ago | 0

| accepted

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

3 years ago | 1

| accepted

Answered
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 = ...

3 years ago | 0

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

3 years ago | 0

| accepted

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

3 years ago | 0

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

3 years ago | 0

| accepted

Load more