Answered
Transformation of the Matrix in a Loop
With your invented notation it's difficult to know what you actually have in matlab. Assuming you have a matrix such as: Z = [...

6 years ago | 1

| accepted

Answered
Old Matlab script not running on newer version
The equivalent of your wavwrite using audiowrite is: audiowrite(fullfile(subj_name, sprintf('%d.wav', block_num)), recordedaudi...

6 years ago | 1

| accepted

Answered
Merging matrices by comparison of values of several columns
Nearly right [~, whichArows, whichBrows] = intersect(out1(:, 2:4), out2(:, 2:4), 'rows'); C = [out2(whichBrows, 5), out1(which...

6 years ago | 0

| accepted

Answered
Using For Loop to get different outcomes
if ismember(psi_value, [0.05, 0.15, 0.25, 0.35]) %maybe use ismembertol s_plot = 0.8; else s_plot = 0.2; end Note ...

6 years ago | 0

Answered
Store a group of points (given x, y, and value) into image efficiently
img = zeros(1000, 1000); img(M(:, 2) + 1000 * (M(:, 1) - 1)) = M(:, 3);

6 years ago | 1

| accepted

Answered
Negative Value when using Trapz
Can someone tell me as to why this is the case Because your x vector is decreasing, so is negative for each trapeze a = trapz...

6 years ago | 2

Answered
Create two arrays on the basis of other arrays
%first find which of A or B elements are going into. Only depends on V isA = false(size(V)); %put in A (true) or B (false) lA...

6 years ago | 0

| accepted

Answered
Create a random sequence based on a matrix columns
A= [1 3 2 4 5 8 9 11 14; 0 0 0 7 6 12 0 0 0; 0 0 0 0 10 13 0 0 0]; %first add an extra column of 0s if the num...

6 years ago | 0

| accepted

Answered
convert nested struct to matrix
Well, you obviously can't concatenate vectors of dfferent sizes so if you want to do that you either have to trim the longer vec...

6 years ago | 0

| accepted

Answered
Timetable Monthly Average over Many Years
The easiest: precip = table2timetable(readtable('CR_precip.csv')); monthlyavg = groupsummary(precip, 'day', 'monthofyear', 'me...

6 years ago | 4

| accepted

Answered
How to extract strings from a table?
Why is the size of the array hardcoded (which means the code will break if something change with the file) instead of just askin...

6 years ago | 0

| accepted

Answered
Combining consecutive vectors into a matrix
You must have changed the options of the wizard to specifically create variables from the columns of the excel spreadsheet. Don'...

6 years ago | 1

Answered
Index in position 2 exceeds array bounds (must not exceed 4).
I don't know what else you expect from your code. You purposefully create an array data with 4 columns and then write: .. = 1/...

6 years ago | 0

Answered
how can I save the data generated from a function that depends on 3 parameters
Assuming the outputs of proprad are all scalar: [Wpig, chla, starch_content] = ndgrid(3:0.5:8, 0.6:0.2:0.5, 2:4:52); [Waveleng...

6 years ago | 0

| accepted

Answered
How to convert data with 3Dimensions to cell array
The simplest is: B = num2cell(A, [1, 2]); %keep rows and columns together, split the pages This will give you a 1x1x2353 cell...

6 years ago | 0

| accepted

Answered
Saving textfiles in a other folder
It's never a good idea to modify the matlab path (with addpath or others) just to read or write data files. The simplest way t...

6 years ago | 0

| accepted

Answered
How can I merge a row from one table to a second table with more data based on name?
it's not clear what you want the new table to be, nor what you want to do afterward with it (save it?). Here's a start. Adapt as...

6 years ago | 0

Answered
fsolve on polynominal function
Solving is the same as solving , which is easily solved with roots: roots([a, b, c-1]) your myfun doesn't make much sense: y...

6 years ago | 0

Answered
How do I make matrix of ones and zeros alternating depending on size and elements of an array?
Here's a fairly simple way: B = zeros((numel(A)+1)/2, sum(A)); for row = 1:2:numel(A) B(ceil(row/2), :) = repelem([0, 1, ...

6 years ago | 1

Answered
How would I 'trim-the-fat' off of individual text files that are part of a loop?
If I understood correctly: opt = detectImportOptions(yourtextfile); opt.DataLines = [1 36e6]; %only read the first 36000000 l...

6 years ago | 0

Answered
Replacing variable names when using func2str of anonymous function
As I suggested, it's possible to do this with the undocumented mtree function: function fstr = replacevar(fstr, vars, replaceme...

6 years ago | 1

| accepted

Answered
how to obtain values using a key in another table?
First, convert the date strings into proper dates. However you imported that data, you should be able to import it directly as d...

6 years ago | 0

Answered
Use "datastore" on a .cvs file without headers (or matlab identifiers)
Use the ReadVariableNames option: ds = datastore(somelocation, 'ReadVariableNames', false)

6 years ago | 0

| accepted

Answered
Infrared Thermography Image Analysis Code Error
The mouse coordinates returned by ginput are rarely integers so, indeed, you can't use them as is as image pixel coordinates. Th...

6 years ago | 0

Answered
From .csv to .mat, matrix indexing
Not exactly sure what you're asking, is it simply? labelFaceGrid = T{:, 4:7}; %extract column 4 to 7 as a matrix

6 years ago | 1

| accepted

Answered
What exactly is going on with this code? I'm having difficulty understanding it
Removing all the unnecessary cruft, this is probably what the code reduces to. I've gone with the fact that your files are 400,0...

6 years ago | 1

| accepted

Answered
Check if I have done everything right
2) you haven't done what's asked (plot the function) 4) is wrong (hint clear f and run that again) 5) you haven't done what's ...

6 years ago | 0

Answered
Create an array from a cell array
For just one element of the cell array, eg. G{1}: [uval, loc1, ids] = unique(G{1}(1, :)); %get unique values of first row, wi...

6 years ago | 0

| accepted

Answered
Does Matlab support GTX 1660 graphics card?
If you're talking about using the card for GPU computing, the actual model is not important, it's the architecture. All the card...

6 years ago | 0

Answered
What is the problem with my code? please help me
Isn't the error message clear enough? Undefined function 'randon' ... Indeed, I'm not aware of a randon function in matlab. Ma...

6 years ago | 0

Load more