Respondida
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 = [...

más de 6 años hace | 1

| aceptada

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

más de 6 años hace | 1

| aceptada

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

más de 6 años hace | 0

| aceptada

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

más de 6 años hace | 0

Respondida
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);

más de 6 años hace | 1

| aceptada

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

más de 6 años hace | 2

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

más de 6 años hace | 0

| aceptada

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

más de 6 años hace | 0

| aceptada

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

más de 6 años hace | 0

| aceptada

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

más de 6 años hace | 4

| aceptada

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

más de 6 años hace | 0

| aceptada

Respondida
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'...

más de 6 años hace | 1

Respondida
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/...

más de 6 años hace | 0

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

más de 6 años hace | 0

| aceptada

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

más de 6 años hace | 0

| aceptada

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

más de 6 años hace | 0

| aceptada

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

más de 6 años hace | 0

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

más de 6 años hace | 0

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

más de 6 años hace | 1

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

más de 6 años hace | 0

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

más de 6 años hace | 1

| aceptada

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

más de 6 años hace | 0

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

más de 6 años hace | 0

| aceptada

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

más de 6 años hace | 0

Respondida
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

más de 6 años hace | 1

| aceptada

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

más de 6 años hace | 1

| aceptada

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

más de 6 años hace | 0

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

más de 6 años hace | 0

| aceptada

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

más de 6 años hace | 0

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

más de 6 años hace | 0

Cargar más