Answered
How to Calculate an area in MATLAB
This line: Curve_Area= polyarea(x,y) Should be Curve_Area= polyarea(x(k),y(k)) Then you shall get: Triangle_A = 0.48...

5 years ago | 0

| accepted

Answered
Hide peaks ticks and number on plots
Try: load('pO2,Mean,Numeric,Float,Raumedic,data_part1of1.mat'); ox = measurement_data; smooth_ox = smooth(ox, 0.01, 'loess'...

5 years ago | 1

Answered
how to count occurrences of a variable in a matrix?
A = {'Red', 'Blue', 'Green', 'Yellow', 'White'; 'Red', 'Black', 'Purple', 'Red', 'White'} ; nnz(strcmp(A,'Red'))

5 years ago | 1

| accepted

Answered
If loop on lists for counting elements
A0 = [1,3,5,9]; A1 = [2,5,1,0]; idx = A0' < A1 ; iwant = nnz(idx(:)) ;

5 years ago | 0

Answered
If loop on lists for counting elements
A0 = [1,3,5,9]; A1 = [2,5,1,0]; iwant = 0 ; for i = 1:length(A0) t = nnz(A0(i)<A1) ; iwant = iwant+t ; end

5 years ago | 0

Answered
Multiplying elements of a matrix and its transpose row-wise
iwant = sum(A.*A) ; where A is your 500*2 matrix.

5 years ago | 1

Answered
Index in position 2 exceeds array bounds.(keep appearing this although I tried different arrays)
xlsread is obselete. USe readtable. T = readtable(rawDataFile,'Sheet1'); You can convert it to the array using table2array....

5 years ago | 0

Answered
Convert Time Given in Seconds to Minute, Seconds, Milliseconds
Read about datetime and hms. https://in.mathworks.com/help/matlab/ref/datetime.hms.html

5 years ago | 0

Answered
manipulate table containing numeric and string
If T is your table... T1 = T(T.(1)==1,:)

5 years ago | 0

| accepted

Answered
How to apply canonical correlation analysis to dataset
Let your X data set 100*4 has features (columns) represented by x1, x2, x3 and x4. For Y 100*2, let the features (columns) be y1...

5 years ago | 0

Answered
add each iteration of for loop to a table
f=dir('*.csv'); T = zeros(length(f),[]) ; for i=1:length(f) x=readtable(f(i).name) y=[sum(x.LogicRate100),sum(x.Log...

5 years ago | 1

| accepted

Answered
Function that creates figures only?
function fig = myfunc() Z = peaks(100) ; fig(1) = figure ; pcolor(Z) ; shading interp ; fig(2) = figure ; surf(Z) ; s...

5 years ago | 1

| accepted

Answered
Average numbers in array
You may proceed some like this shown below: T = readtable('C:\Users\KSSV\Downloads\1.xlsx') ; x = T.(1) ; y = T.(2) ; idx =...

5 years ago | 0

Answered
How to plot table to figure?
Have a look on the heatmap. You can also achieve it using: pcolor to plot the colors shown. USe text to display the numbers. ...

5 years ago | 1

| accepted

Answered
There is an error in line 3. I can't figure out what the error is. Please help me find out.
A = [ 1 2 3 4 5 6 7 8 9] ; B = triu(A) iwant = sum(B(:))

5 years ago | 0

Answered
How to elegantly open or create new file for reading and writing but not discard existing contents?
Read the documentation of fopen, there are multiple options present. https://in.mathworks.com/help/matlab/ref/fopen.html . l...

5 years ago | 0

Answered
Create Streamlines with Curvilinear Grid
load('streamline_help.mat') x = gridx_subset ; y = gridy_subset ; u = u_subset ; v = v_subset ; % Remove nans idx = ~isn...

5 years ago | 0

| accepted

Answered
it is giving me error in system generated code with a message not enough input argument in ifact program code
Don't run the code straight away using run button. Save the function in a folder, go to that folder and call it in the workspace...

5 years ago | 0

Answered
how to plot more than one function with out using fplot?
You have to limit the y-axes if you want to limit to desired ranges. Read about ylim. x = linspace(-4,4,1000); %functions fx...

5 years ago | 0

Answered
Write image info using imwrite or other method
Read the documentation, thre are options mentioned to write into image. https://in.mathworks.com/help/matlab/ref/imwrite.html ...

5 years ago | 0

Answered
hello, im trying to plot 2 functions on the same graph but the functions arent showing up
x = 0:0.1:10 ; % take your required range of x-values x1 = (x-3)./(x-2) ; x2 = (2*x-3)./(x-1) ; plot(x,x1,'r',x,x2,'b')

5 years ago | 0

| accepted

Answered
How can I extract data from a heat map using separate point coordinates?
Read about interp2.

5 years ago | 1

| accepted

Answered
How do I iterate variable names when loading dicom files?
files = dir('*dcm') ; N = length(files) ; for i = 1:N file = files(i).name ; % do what you want end

5 years ago | 0

Answered
How to store data from every cycle in while a loop?
ptCloud=pcread('1_no_OK.ply'); %this is the whole point cloud zLim=[0,0.5]; %section interval ptCloudSegmented = cell([]...

5 years ago | 1

| accepted

Answered
Extracting values at specific dates from a timetable
Multiple options. You can convert them to datenum and use logical, comparisons. Convert them into same Datetime calss and use...

5 years ago | 1

| accepted

Answered
How does psnr calculate the PSNR of PNG color images?
You can check how psnr is calculated from this file exchange: https://in.mathworks.com/matlabcentral/fileexchange/135-psnr. Yo...

5 years ago | 0

Answered
Accessing a column of a structure array
names = {Files_cal (:).name} ; celldisp(names)

5 years ago | 0

| accepted

Answered
How to create matrix using for loop and if statment
number_of_the_yearly_day = 1:1:365; %n T=1:1:24; declination=23.45.*sin((2.*pi.*(number_of_the_yearly_day-80))./(365));%? lat...

5 years ago | 0

Answered
vector length problem error
w1=0.1*pi; w2=0.2*pi; w3=0.3*pi; w4=0.4*pi; w5=0.5*pi; w6=0.6*pi; t=0:1000; x=sin(w1*t)+sin(w2*t)+sin(w3*t)+sin(w4*t)+sin...

5 years ago | 0

| accepted

Answered
Addition of identical matrix sections
Read about unique. A = [1 2 3 4 5 6; ... 2 3 4 2 3 1; ... 2 4 2 2 2 2; ... 1 2 3 1 1 1]; ...

5 years ago | 1

| accepted

Load more