Risposto
How can I only select table data from a text file.
a=readmatrix('G2_A.txt', 'NumHeaderLines',8)

quasi 3 anni fa | 0

Risposto
Removing commas between columns in text data
test = {'Sometimes, ,, I, use, commas, .' 'I, like, writing, ,, I, like, reading'}; test = regexprep(test, ',\s', ' ') ...

quasi 3 anni fa | 0

Risposto
Show limited digits numbers.
You can use fprintf with format specifier to format the print out. "doc fprintf". A=2.54357766; fprintf('%.6f\n', A);

quasi 3 anni fa | 0

Risposto
Change string words to number in table
% Assume the column has the data x.omst=["Clouds"; "Rain"; "Clear"] % You can use the categorical data x.omst = categorical(x...

quasi 3 anni fa | 0

| accettato

Risposto
Deleting unnecessary values in numerical array
% Assume that your data in second column is sorted. x = [ 1420 1 1410 1 1400 1 1390 0.9 1380 0.8 1370 0.7 1300 0 1290 0...

quasi 3 anni fa | 0

| accettato

Risposto
99x99 matrix
% For time comparison: n = 1000; timeit(@() bidiag1(n)) timeit(@() bidiag2(n)) timeit(@() bidiag3(n)) function bidiag1(n)...

quasi 3 anni fa | 0

Risposto
99x99 matrix
n = 9; %99 A = eye(n); A(n:n-1:n*n-1) = 1; % anti-diagonal A

quasi 3 anni fa | 0

Risposto
How can I generate a square lattice undirected graph?
n = 10; A = delsq(numgrid('S',n+2)); G = graph(A,'omitselfloops'); h = plot(G); h.XData = floor((0:99)/10); h.YData = rem((...

quasi 3 anni fa | 0

| accettato

Risposto
add an line for the coasts of the continents used for the geodensityplot in the mapping toolbox
mapping toolbox has the convention of lat-lon coordinates rather than lon-lat. try the following in your code: lon = linspace(...

quasi 3 anni fa | 0

| accettato

Risposto
How can I add more colors to semilogy?
plot(rand(30,20)+(1:20)); % plot 20 lines legend % The following line will change the default ColorOrder (7 colors) % change...

quasi 3 anni fa | 0

Risposto
how to change the front size and the inclination in a bar graph
h = gca; h.XTickLabelRotation = 0; % not recommended for long string h.TickLabelInterpreter = 'none';

quasi 3 anni fa | 0

Risposto
How do i remove conj from differention?
clear all syms x v s a y z r t real syms x(t) y(t) assumeAlso([y(t),x(t)],'real') A=[x, diff(y(t),t), s; y, z, r; s x(...

quasi 3 anni fa | 0

| accettato

Risposto
How to change the values of both axes
%Define variables sigma = 35*10^6; young_modulus = 90*10^9; strain_coefficient = 6*10^-9; magnetic_field = linspace(0, 16000...

quasi 3 anni fa | 0

Risposto
Selecting files from a directory
sims = pwd; %uigetdir ('C:\Matlab') save test.in sims % create a file info = dir(fullfile(sims,'*.in')) list = {info(~[info...

quasi 3 anni fa | 0

| accettato

Risposto
fit function does not work correctly
If the StartPoint is good enough, you can get the correct fitting. t = [0:0.01:6]'; %Test with a cosinus function y = cos(t*3...

quasi 3 anni fa | 0

Risposto
Display values of each element in imagesc
c = randi([0 40], [16 16]); heatmap(c); colormap(jet(512))

quasi 3 anni fa | 2

| accettato

Risposto
How to plot this frequency graph?
load runoff load precipitation precipitation = normalize(precipitation, 'range'); runoff = normalize(runoff, 'range'); histo...

quasi 3 anni fa | 1

| accettato

Risposto
How can I extract the values form the cell array?
Obviously, you don't have a matlab cell array (is it a python array?). The matlab array may look like the following: a(1).name...

quasi 3 anni fa | 0

| accettato

Risposto
Find the index of a value closest to a constant value in 3D array when the index of row and column are given
B(:,:,1) =[ 1 2 4 2 7 8 9 0]; B(:,:,2) =[ 9 2 4 7 0 1 2 ...

quasi 3 anni fa | 0

| accettato

Risposto
Sparse Matrix with Same number of non-zero values in each column
A = createMatrix(8, 4); full(A) function A = createMatrix(n, k) A = sparse(n,n); for i=1:n A(randperm(n, k), i) = 1/k; ...

quasi 3 anni fa | 0

| accettato

Risposto
Displaying frames captured by getframe(h) at original size
You can use "imshow" which by default show images in 100% magnification. "doc imshow" for more details.

quasi 3 anni fa | 0

| accettato

Risposto
using imagesc to plot a matrix of data
%C = 0.1:0.1:0.2; C = [0.1 0.2]; % There are only two points along x F = 0.1:0.1:0.5; figure(1) subplot(1,3,1) mean_GT...

quasi 3 anni fa | 0

| accettato

Risposto
How to create a circle filled with equidistant points inside it?
Here is a sub-optimal (or almost optimal) solution. Filled dots will form the hexagonal formation. radius = 10; d = 1; % dis...

quasi 3 anni fa | 0

| accettato

Risposto
How I plot a matrix wich each rows is a different curves on the graph?
a = randn(6, 21); plot(a')

quasi 3 anni fa | 0

| accettato

Risposto
How to Convert Magnitude(g/N)/Phase (degrees) data in to Complex Receptance (m/N)
x =[0.00000e+000 1.16597e+002 -1.80000e+002 3.12500e-001 9.33462e+001 5.02240e+001 6.25000e-001 ...

quasi 3 anni fa | 0

Risposto
3D Plot of a Matrix with only Char data type
x= {'USA', 'Germany', 'South Africa', 'China', 'Mexico', 'Australia'}; y = {'America', 'Europe', 'Africa', 'Asia', 'South Amer...

quasi 3 anni fa | 0

Risposto
Massive time required for pdist
%tic X = rand(1000,2); Y = rand(1000,2); % fprintf('Time for array creation: '); %toc %% Version 1 tic j=1; for i = ...

quasi 3 anni fa | 0

| accettato

Risposto
How to arrange the constraints shape to A matrix and b constants automatically ( Ax <= b)??
% Let x = [x1; x2; x3; x4] % x1 + x2 <= x3 + x4 + 1 ; % constraint 1 % => [1 1 -1 -1]*x <= 1 % X3 <= x1 + 10 ; % cons...

quasi 3 anni fa | 0

Risposto
Array of Structures to Structure of arrays
% array of structure M = 5; for i=1:M a(i).f1 = rand(1,1); a(i).f2 = rand(1,1); end a a(1) % struncrure of arr...

quasi 3 anni fa | 0

Risposto
How to detect and delete similar value rows in Matlab?
A =[1 2 3 4; 1 3 4 2; 1 4 2 4; 1 3 2 2]; % For columns with the same values i = find(all(diff(A, 1)==0, 1)); ...

quasi 3 anni fa | 0

Carica altro