Answered

How to compare 2 Boolean Stairs graph

clc clear A = randi([0 1], 1,10); B = randi([0 1], 1,10); data={A,B,A==B}; for kk=1:3 subplot(3,1,kk) stairs(data{k...

How to compare 2 Boolean Stairs graph

clc clear A = randi([0 1], 1,10); B = randi([0 1], 1,10); data={A,B,A==B}; for kk=1:3 subplot(3,1,kk) stairs(data{k...

6 months ago | 1

Answered

how to write into excel columnwise

for k=1:numoffiles filename=filesinfolder(kkk).name; fid=fopen(filename); %open the file tline = fgetl(fid); ...

how to write into excel columnwise

for k=1:numoffiles filename=filesinfolder(kkk).name; fid=fopen(filename); %open the file tline = fgetl(fid); ...

6 months ago | 0

| accepted

Submitted

ncreadtime

This function helps user to read the time variable in netcdf file in a specific matlab readable format

6 months ago | 1 download |

Answered

Problem with *txt File Format conversion using Matlab

I have used a sample file just like yours (attached). Hope it helps. clc clear formatSpec = '%14s%5s%5s%5s%5s%5s%5s%5s%5s%5s%...

Problem with *txt File Format conversion using Matlab

I have used a sample file just like yours (attached). Hope it helps. clc clear formatSpec = '%14s%5s%5s%5s%5s%5s%5s%5s%5s%5s%...

6 months ago | 0

Answered

write a code to sort string

str=input('Enter string:','s'); strsplit(str,',') On which basis you wish to sort strings? Is it alphabatically, or based on t...

write a code to sort string

str=input('Enter string:','s'); strsplit(str,',') On which basis you wish to sort strings? Is it alphabatically, or based on t...

6 months ago | 0

Answered

Combine 2 datasets and include the duplicates

clc clear postcodes=randi(20,50,1); areas=randi(10,50,5); area_unique=unique(areas); for ii=1:length(area_unique) ...

Combine 2 datasets and include the duplicates

clc clear postcodes=randi(20,50,1); areas=randi(10,50,5); area_unique=unique(areas); for ii=1:length(area_unique) ...

6 months ago | 0

Answered

How to plot many images in a loop

for i=1:5 imwrite(randi(255,250,205)/255,sprintf('Image_%d.png',i)) end

How to plot many images in a loop

for i=1:5 imwrite(randi(255,250,205)/255,sprintf('Image_%d.png',i)) end

6 months ago | 0

| accepted

Answered

How to store data in a for loop

If you wish to save into cell, then you can use: for i=1:100 trainin = x(:,tr.trainInd); trainTarg1= t(:,tr.trainInd...

How to store data in a for loop

If you wish to save into cell, then you can use: for i=1:100 trainin = x(:,tr.trainInd); trainTarg1= t(:,tr.trainInd...

6 months ago | 0

| accepted

Answered

Remove legend for specific data

for i=1:n1 plot_lin(i)=plot(f{n1-i+1},Sx_dB{n1-i+1},'DisplayName',['Node ',num2str(n1-i+1)]) xlabel('Frequency (Hz)');...

Remove legend for specific data

for i=1:n1 plot_lin(i)=plot(f{n1-i+1},Sx_dB{n1-i+1},'DisplayName',['Node ',num2str(n1-i+1)]) xlabel('Frequency (Hz)');...

6 months ago | 0

| accepted

Answered

Running a code on multiple input files and get results

clc clear F=dir('BWSN_flus*inp') for kk=1:length(F) filename=F(kk).name % DO YOUR CALCULATIONS outputfilename=...

Running a code on multiple input files and get results

clc clear F=dir('BWSN_flus*inp') for kk=1:length(F) filename=F(kk).name % DO YOUR CALCULATIONS outputfilename=...

6 months ago | 0

| accepted

Answered

How to create a loop that runs through the rows of a table?

clc clear A=randi(20,25,5); %generating random data T = array2table(A); equation= @(x) x*5 + log(x) % creating an equati...

How to create a loop that runs through the rows of a table?

clc clear A=randi(20,25,5); %generating random data T = array2table(A); equation= @(x) x*5 + log(x) % creating an equati...

6 months ago | 0

Answered

Error: This statement is incomplete.

You need to provide sufficient arguments while calling the function. knn_func(2,4,8,1)

Error: This statement is incomplete.

You need to provide sufficient arguments while calling the function. knn_func(2,4,8,1)

6 months ago | 0

Answered

Summing up two graphs with different starting point

Method 1: Using boolean clc clear YY=rand(151,2); XX=[[50:5:800]' [175:5:925]'] data=[XX(:,1) YY(:,1) XX(:,2) YY(:,2)] p...

Summing up two graphs with different starting point

Method 1: Using boolean clc clear YY=rand(151,2); XX=[[50:5:800]' [175:5:925]'] data=[XX(:,1) YY(:,1) XX(:,2) YY(:,2)] p...

6 months ago | 0

| accepted

Answered

Getting the piecewise polynomial function of a 3D plot

You can use interp2 to calculate values programmatically. clc clear [X,Y] = meshgrid(-5:1:5); Z = Y.*sin(X) - 5*X.*cos(2*Y);...

Getting the piecewise polynomial function of a 3D plot

You can use interp2 to calculate values programmatically. clc clear [X,Y] = meshgrid(-5:1:5); Z = Y.*sin(X) - 5*X.*cos(2*Y);...

6 months ago | 0

Answered

replacing rows with values from another matrix

Since you have not attached any speciific data, I am generating random values and indices to change. clc clear original_mat=r...

replacing rows with values from another matrix

Since you have not attached any speciific data, I am generating random values and indices to change. clc clear original_mat=r...

6 months ago | 0

| accepted

Answered

Matlab Output Format!

You cannot format the output, but you can use disp to print in that way: a=1; disp('a=1') disp(sprintf('a=%d',a)) You can us...

Matlab Output Format!

You cannot format the output, but you can use disp to print in that way: a=1; disp('a=1') disp(sprintf('a=%d',a)) You can us...

6 months ago | 0

Answered

Parse txt file that is organized with different sections from top to bottom?

Attached is the text file. clc clear fileID = fopen('sample_text.txt','r'); dataArray = textscan(fileID, '%s%[^\n\r]', 'Deli...

Parse txt file that is organized with different sections from top to bottom?

Attached is the text file. clc clear fileID = fopen('sample_text.txt','r'); dataArray = textscan(fileID, '%s%[^\n\r]', 'Deli...

6 months ago | 0

| accepted

Answered

Compare text to a column value and write corresponding row to new file

You can find the indices of matching values in matrix and cell. matrix=randi(10,1,100); cell_existing_variable=num2cell(randi(...

Compare text to a column value and write corresponding row to new file

You can find the indices of matching values in matrix and cell. matrix=randi(10,1,100); cell_existing_variable=num2cell(randi(...

6 months ago | 0

| accepted

Answered

Plot color is different to the color being shown on the legend

This is an example of plot using different colors. Hope this helps. clc clear x=linspace(0,2*pi,100); xdata={sin(x),cos(x)...

Plot color is different to the color being shown on the legend

This is an example of plot using different colors. Hope this helps. clc clear x=linspace(0,2*pi,100); xdata={sin(x),cos(x)...

6 months ago | 0

Answered

Display strings and variable - cell array

Access the contents of cells by indexing with curly braces, {}. food= { 'Rice','Quinoa','Tortilla','Lentils','Broccoli' }'; ...

Display strings and variable - cell array

Access the contents of cells by indexing with curly braces, {}. food= { 'Rice','Quinoa','Tortilla','Lentils','Broccoli' }'; ...

6 months ago | 0

Answered

Problem setting axis label dimensions

figure1=figure('Color','White','Position',[1,41,1000,600],'Renderer', 'Painters') size_labels=24; legend_label=13; ticks_labe...

Problem setting axis label dimensions

figure1=figure('Color','White','Position',[1,41,1000,600],'Renderer', 'Painters') size_labels=24; legend_label=13; ticks_labe...

6 months ago | 0

| accepted

Answered

figure 4 Y axis with 1 x axis

You can use this function from the file exchange. clc clear t=linspace(0,pi,100); sinplot=sin(t); cosplot=cos(t); tanplot...

figure 4 Y axis with 1 x axis

You can use this function from the file exchange. clc clear t=linspace(0,pi,100); sinplot=sin(t); cosplot=cos(t); tanplot...

6 months ago | 0

| accepted

Answered

How to modify vector length ??

You can use interp1 to do that. data1_per_second=randi(25,1,604800); data2_per_minute=randi(25,1,10080); data2_per_second=int...

How to modify vector length ??

You can use interp1 to do that. data1_per_second=randi(25,1,604800); data2_per_minute=randi(25,1,10080); data2_per_second=int...

6 months ago | 1

| accepted

Answered

Storing elements to a matrix

3D data can be converted to 2D using reshape. You just need to reshape your matrix based on your requirements. A1=reshape(M,3,[...

Storing elements to a matrix

3D data can be converted to 2D using reshape. You just need to reshape your matrix based on your requirements. A1=reshape(M,3,[...

6 months ago | 0

| accepted

Answered

plot of markers, having different color in one line of code.

x2=[1,3]; y2=[3,4]; x3=[3,4,5]; y3=[1,6,7]; cell_values={x2,y2;x3,y3}; col_vals={[0.500 0.3250 0.0500],[0.8500 0.3250 0.0...

plot of markers, having different color in one line of code.

x2=[1,3]; y2=[3,4]; x3=[3,4,5]; y3=[1,6,7]; cell_values={x2,y2;x3,y3}; col_vals={[0.500 0.3250 0.0500],[0.8500 0.3250 0.0...

6 months ago | 0

Answered

How to evaluate an algebraic expression at a certain point when it is in a matrix?

You can use matlabFunction to create an anonymous function, which will eventually help to calcuate the values at specific x1 and...

How to evaluate an algebraic expression at a certain point when it is in a matrix?

You can use matlabFunction to create an anonymous function, which will eventually help to calcuate the values at specific x1 and...

6 months ago | 1

| accepted

Answered

How to open a cell array??

out=zeros(length(result_pettitt),max(cellfun(@(x) length(x), result_pettitt))); for kk=1:length(result_pettitt) out(kk,1:l...

How to open a cell array??

out=zeros(length(result_pettitt),max(cellfun(@(x) length(x), result_pettitt))); for kk=1:length(result_pettitt) out(kk,1:l...

6 months ago | 1

| accepted

Answered

Deleting the same empty row in 2 different column vectors - then searching a value giving the other column vector result

load_mapping_csv Mapping_refine=Mapping(~strcmp(Mapping(:,3),'[]'),[1:3]); The script of load_mapping_csv is attached, and has...

Deleting the same empty row in 2 different column vectors - then searching a value giving the other column vector result

load_mapping_csv Mapping_refine=Mapping(~strcmp(Mapping(:,3),'[]'),[1:3]); The script of load_mapping_csv is attached, and has...

6 months ago | 0

| accepted

Answered

Colorbar font size decreases upon export

Instead of manually saving the figure, you can prefer to save figure by command. It won't shrink the figure. print('sample','-d...

Colorbar font size decreases upon export

Instead of manually saving the figure, you can prefer to save figure by command. It won't shrink the figure. print('sample','-d...

6 months ago | 0

| accepted

Answered

Copy the same rows from multiple identical files to a single file

Sicne you have not attached any sample file, I am using a file having 5 rows, and extracting 2nd and 5th rows from these. Attach...

Copy the same rows from multiple identical files to a single file

Sicne you have not attached any sample file, I am using a file having 5 rows, and extracting 2nd and 5th rows from these. Attach...

6 months ago | 1

| accepted